<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>商品管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	{include file="public/css"/}
	<style>
		#ggnamediv .layui-input,#ggvaldiv .layui-input{ display:inline;height:30px}
		.guigeimg{display: inline-block; position: relative}
		.guigeimg_close{width: 25px;height: 22px;right: -14px;top:-14px;}
		.layui-imgbox .layui-imgbox-close{z-index: 6;}
		#jieti_discountdiv .layui-input,#jieti_discountdiv .layui-input{ display:inline;height:30px}
	</style>
</head>
<body>
<div class="layui-fluid">
	<div class="layui-row layui-col-space15">
		<div class="layui-card layui-col-md12">
			<div class="layui-card-header">
				{if !$info['id']}<i class="fa fa-plus"></i> 添加商品{else}<i class="fa fa-pencil"></i> 编辑商品{/if}
				<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
			</div>
			<div class="layui-card-body" pad15>
				{if $info['ischecked']==2}<blockquote class="layui-elem-quote" style="color:red">商品未审核通过，驳回原因：{$info.check_reason}</blockquote>{/if}
				<div class="layui-form form-label-w6">
					<div class="layui-tab" lay-filter="mytab">
						<ul class="layui-tab-title">
							<li class="layui-this" lay-id="1">商品信息</li>
							<li lay-id="2">商品参数</li>
							<li lay-id="3">商品详情</li>
							<li lay-id="4">分享设置</li>
						</ul>
						<div class="layui-tab-content">
							<div class="layui-tab-item layui-show">
								<input type="hidden" name="id" value="{$info['id']}"/>
								{if input('param.bid')}<input type="hidden" name="info[bid]" value="{$Request.param.bid}"/>{/if}
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>商品名称：</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="info[name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info['name']}">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label"><span class="redstar">*</span>商品主图：</label>
									<!-- <input type="hidden" name="info[pic]" id="pic" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info['pic']}"> -->
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="pic" upload-preview="picPreview" onclick="uploader(this)">上传图片</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
									<div id="picPreview" class="picsList-class-padding">
										<div class="layui-imgbox imgbox-required">
											<a {if $info['pic']}style="display: block;" {else /} style="display: none;"  {/if} class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().find('img').attr('src','').hide();getpicsval('pic','picPreview');$(this).hide();" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
											<div class="layui-imgbox-img">
												<img src="{$info['pic']}"/>
											</div>
											<input autocomplete='off' type="text" id="pic" name="info[pic]" lay-verify="required" lay-verType="tips" value="{$info['pic']}" style="cursor:default;">
										</div>
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">商品图片：</label>
									<input type="hidden" name="info[pics]" value="{$info['pics']}" id="pics">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="pics" upload-preview="picList" >批量上传</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
									<div id="picList" class="picsList-class-padding">
										{if $info['pics']}{php}$pics = explode(',',$info['pics']);{/php}{foreach $pics as $pic}
										<div class="layui-imgbox">
											<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('pics','picList')" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
											<span class="layui-imgbox-img"><img src="{$pic}"></span>
										</div>
										{/foreach}{/if}
									</div>
								</div>
								{if getcustom('diy_light') && $auth['diy_light']}
								<div class="layui-form-item">
									<label class="layui-form-label">配灯图片：</label>
									<input type="hidden" name="info[diypics]" value="{$info['diypics']}" id="diypics">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="diypics" upload-preview="diypicList" >批量上传</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素，png格式透明背景</div>
									<div id="diypicList" style="float:left;padding-top:10px;padding-left:130px;clear: both;">
										{if $info['diypics']}{php}$diypics = explode(',',$info['diypics']);{/php}{foreach $diypics as $pic}
										<div class="layui-imgbox">
											<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('diypics','diypicList')" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
											<span class="layui-imgbox-img"><img src="{$pic}"></span>
										</div>
										{/foreach}{/if}
									</div>
								</div>
								{/if}
								<div class="layui-form-item">
									<label class="layui-form-label">商品视频：</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="info[video]" id="video" lay-verType="tips" class="layui-input" value="{$info['video']}">
									</div>
									<input type="hidden" name="info[video_duration]" id="video_duration" value="{$info.video_duration}">
									<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="video" onclick="uploader(this)">上传视频</button>
									<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">填写视频链接或上传视频，视频链接必须为mp4格式的源链接，视频大小须在50MB以内</div>
								</div>
								<!-- <div class="layui-form-item">
                                    <label class="layui-form-label">商品服务：</label>
                                    <div class="layui-input-inline" style="width:400px">
                                        <input type="text" name="info[fuwupoint]" class="layui-input" value="{$info['fuwupoint']}">
                                    </div>
                                    <div class="layui-form-mid layui-word-aux">多个用空格隔开,如: 7天退换 48小时发货 假一赔十</div>
                                </div> -->
								<div class="layui-form-item">
									<label class="layui-form-label">商品卖点：</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="info[sellpoint]" class="layui-input" value="{$info['sellpoint']}">
									</div>
									<div class="layui-form-mid layui-word-aux">在商品详情页标题下面展示商品卖点，建议60字以内</div>
								</div>
								{if getcustom('product_keyword')}
								<div class="layui-form-item">
									<label class="layui-form-label">商品关键字：</label>
									<div class="layui-input-inline" style="width:400px">
										<input type="text" name="info[keyword]" class="layui-input" value="{$info['keyword']}">
									</div>
									<div class="layui-form-mid layui-word-aux">可通过商品关键字检索商品</div>
								</div>
								{/if}
								<div class="layui-form-item">
									<label class="layui-form-label">商品分类：</label>
									<div class="layui-input-inline" style="width:400px">
										<select name="info[cid]" id="cid" xm-select="selectCid" xm-select-max="5" xm-select-search >
											<option value="">--请选择--</option>
											{foreach $clist as $cv}
											<option value="{$cv['id']}" {if in_array($cv['id'],$info['cid'])}selected{/if}>{$cv['name']}</option>
											{foreach $cv['child'] as $k=>$v}
											{if $k < count($cv['child'])-1}
											<option value="{$v['id']}" {if in_array($v['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;├ {$v['name']}</option>
											{else}
											<option value="{$v['id']}" {if in_array($v['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;└ {$v['name']}</option>
											{/if}
											{foreach $v['child'] as $k2=>$v2}
											{if $k2 < count($v['child'])-1}
											<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├ {$v2['name']}</option>
											{else}
											<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└ {$v2['name']}</option>
											{/if}
											{/foreach}
											{/foreach}
											{/foreach}
										</select>
									</div>
									<div class="layui-form-mid layui-word-aux">最多可选5个分类</div>
									<!-- <div class="layui-form-mid layui-word-aux"><a href="categoryadd.php">创建分类</a></div> -->
								</div>
								{if $bid > 0}
								<div class="layui-form-item">
									<label class="layui-form-label">商家商品分类：</label>
									<div class="layui-input-inline" style="width:400px">
										<select name="info[cid2]" id="cid2" xm-select="selectCid2" xm-select-max="5" xm-select-search >
											<option value="">--请选择--</option>
											{foreach $clist2 as $cv}
											<option value="{$cv['id']}" {if in_array($cv['id'],$info['cid2'])}selected{/if}>{$cv['name']}</option>
											{foreach $cv['child'] as $k=>$v}
											{if $k < count($cv['child'])-1}
											<option value="{$v['id']}" {if in_array($v['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;├ {$v['name']}</option>
											{else}
											<option value="{$v['id']}" {if in_array($v['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;└ {$v['name']}</option>
											{/if}
											{foreach $v['child'] as $k2=>$v2}
											{if $k2 < count($v['child'])-1}
											<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├ {$v2['name']}</option>
											{else}
											<option value="{$v2['id']}" {if in_array($v2['id'],$info['cid2'])}selected{/if}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;└ {$v2['name']}</option>
											{/if}
											{/foreach}
											{/foreach}
											{/foreach}
										</select>
									</div>
									<div class="layui-form-mid layui-word-aux">最多可选5个分类</div>
								</div>
								{/if}
								<div class="layui-form-item">
									<label class="layui-form-label">商品分组：</label>
									<div class="layui-input-inline" style="width:600px">
										{php} $gids = explode(',',$info['gid']);{/php}
										{foreach $glist as $g}<input type="checkbox" name="info[gid][]" value="{$g['id']}" {if in_array($g['id'],$gids)}checked{/if} title="{$g['name']}" lay-skin="primary">{/foreach}
									</div>
									<!-- <div class="layui-form-mid layui-word-aux"><a href="groupadd.php">创建分组</a></div> -->
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">商品服务：</label>
									<div class="layui-input-inline" style="width:600px">
										{php} $fwids = explode(',',$info['fwid']);{/php}
										{foreach $fuwulist as $fuwu}<input type="checkbox" name="info[fwid][]" value="{$fuwu['id']}" {if in_array($fuwu['id'],$fwids)}checked{/if} title="{$fuwu['name']}" lay-skin="primary">{/foreach}
									</div>
									<!-- <div class="layui-form-mid layui-word-aux"><a href="groupadd.php">创建分组</a></div> -->
								</div>
								{if getcustom('product_bind_mendian')}
								<div class="layui-form-item">
									<label class="layui-form-label">销售门店：</label>
									<div class="layui-input-inline" style="width:80%">
										{php} $bind_mendian_ids = $info['bind_mendian_ids']?explode(',',$info['bind_mendian_ids']):[];{/php}
										<input type="checkbox" name="info[bind_mendian_ids][]" value="-1" {if !$info['id'] || !$info['bind_mendian_ids'] || in_array('-1',$bind_mendian_ids)}checked{/if} title="所有" lay-skin="primary">
										{foreach $mendianlist as $mendian}
										<input type="checkbox" name="info[bind_mendian_ids][]" value="{$mendian['id']}" {if in_array($mendian['id'],$bind_mendian_ids)}checked{/if} title="{$mendian['name']}" lay-skin="primary">
										{/foreach}
									</div>
									<!-- <div class="layui-form-mid layui-word-aux"><a href="groupadd.php">创建分组</a></div> -->
								</div>
								{/if}
								
								<div class="layui-form-item">
									<label class="layui-form-label">商品编码：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[procode]" class="layui-input" value="{$info['procode']}">
									</div>
								</div>
								{if $barcode}
								<div class="layui-form-item">
									<label class="layui-form-label">商品条码：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[barcode]" class="layui-input" value="{$info['barcode']}">
									</div>
								</div>
								{/if}

								{if getcustom('product_unit')}
								<div class="layui-form-item">
									<label class="layui-form-label">商品单位：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[product_unit]" class="layui-input" value="{$info['product_unit']}">
									</div>
									<div class="layui-form-mid layui-word-aux">拼接在价格后展示</div>
								</div>
								{/if}
								{if getcustom('to86yk')}
								<div class="layui-form-item">
									<label class="layui-form-label">对应tid：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[to86yk_tid]" class="layui-input" value="{$info['to86yk_tid']}">
									</div>
								</div>
								{/if}

								{if getcustom('pay_yuanbao')}
								<div class="layui-form-item">
									<label class="layui-form-label">{:t('元宝')}价：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[yuanbao]" class="layui-input" value="{$info['yuanbao']}">
									</div>
									<div class="layui-form-mid layui-word-aux">大于0时启用，设置后还需要支付{$yuanbao_money_ratio}%比例的现金</div>
								</div>
								{/if}

								<div class="layui-form-item">
									<label class="layui-form-label">商品类型：</label>
									<div class="layui-input-inline" style="width: 50%">
										<input type="radio" name="info[product_type]" value="0" lay-filter="productType" class="layui-input" {if !$info || $info.product_type==0}checked{/if} title="普通商品">
										{if getcustom('product_glass')}
										<input type="radio" name="info[product_type]" value="1" lay-filter="productType" class="layui-input" {if $info && $info.product_type==1}checked{/if} title="眼镜商品">
										{/if}
										{if getcustom('product_weight') && ($auth_data=='all' || in_array('ProductWeight',$auth_data))}
										<input type="radio" name="info[product_type]" value="2" lay-filter="productType" class="layui-input" {if $info && $info.product_type==2}checked{/if} title="称重商品">
										{/if}
										{if getcustom('product_handwork')}
										<input type="radio" name="info[product_type]" value="3" lay-filter="productType" class="layui-input" {if $info && $info.product_type==3}checked{/if} title="手工活商品">
										<input type="hidden" class="product_type" value="{$info.product_type?$info.product_type:'0'}" class="layui-input">
										{/if}
										{if getcustom('product_wholesale')}
										<input type="radio" name="info[product_type]" value="4" lay-filter="productType" class="layui-input" {if $info && $info.product_type==4}checked{/if} title="批发商品">
										<input type="hidden" class="product_type" value="{$info.product_type?$info.product_type:'0'}" class="layui-input">
										{/if}
									</div>
								</div>
								{if getcustom('product_wholesale')}
								<div class="layui-form-item jieti_discount" style="{if $info['product_type']!=4}display:none{/if}">
									<label class="layui-form-label">批发类型：</label>
									<div class="layui-input-inline">
										<input type="radio" name="info[jieti_discount_type]" value="1" title="整批" {if !$info['id'] || $info['jieti_discount_type']==1}checked{/if} lay-filter=""/>
										<input type="radio" name="info[jieti_discount_type]" value="0" title="混批" {if $info['id'] && $info['jieti_discount_type']==0}checked{/if} lay-filter=""/>
									</div>
									<div class="layui-form-mid layui-word-aux">混批:所有规格的商品的数量达标，整批：单个规格的购买数量达标</div>
								</div>
								<div class="layui-form-item jieti_discount" style="{if $info['product_type']!=4}display:none{/if}">
									<label class="layui-form-label">阶梯价格：</label>
									<div class="layui-input-inline" style="width:auto">
										<table id="jieti_discountdiv"  class="layui-table" style="width:700px">
											<thead>
											<tr>
												<th>购买数量阶梯设置价格折扣比例</th>
												<th>操作</th>
											</tr>
											</thead>
											{php} $jieti_discount_data = json_decode($info['jieti_discount_data']);{/php}
											{if $jieti_discount_data}
											{foreach $jieti_discount_data as $k=>$jditem}
											<tr>
												<td width="550">
													<div>
														<input type="number" class="layui-input" name="jd_start_num[]" value="{$jditem->start_num}" placeholder="起始数量" style="width:90px"> ~
														<input type="number" class="layui-input" name="jd_end_num[]" value="{$jditem->end_num}" style="width:200px" placeholder="数量(最高时可不填写)"/>
														<input type="number" class="layui-input" name="jd_ratio[]" value="{$jditem->ratio}" style="width:90px" placeholder="比例"/> %
													</div>	
												</td>
												{if $k==0}
												<td width="50"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addjieti_discount()">添加</button></td>
												{else}
												<td width="50"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>
												{/if}
											</tr>
											{/foreach}
											{else}
											<tr>
												<td width="550">
													<div>
														<input type="number" class="layui-input" name="jd_start_num[]" value="" placeholder="起始数量" style="width:90px"> ~
															<input type="number" class="layui-input" name="jd_end_num[]" value="" style="width:200px" placeholder="结束数量(最高时可不填写)"/>
															<input type="number" class="layui-input" name="jd_ratio[]" value="" style="width:90px" placeholder="比例"/> %
				
												</td>
												<td width="50"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addjieti_discount()">添加</button></td>
											</tr>
											{/if}
										</table>
										<div class="layui-word-aux"></div>
									</div>
								</div>
								<script>
								function addjieti_discount(){
									var jdhtml = '<tr>';

										jdhtml += '<td width="550">';
											jdhtml += '<div>';
												jdhtml += '<input type="number" class="layui-input" name="jd_start_num[]" value="" placeholder="起始数量" style="width:90px;"> ~';
												jdhtml += '<input type="number" class="layui-input" name="jd_end_num[]" value="" style="width:200px;margin-left:4px" placeholder="结束数量(最高时可不填写)"/>';
												jdhtml += '<input type="number" class="layui-input" name="jd_ratio[]" value="" style="width:90px;margin-left:4px" placeholder="比例"/> %';
												jdhtml += '</div>';
												jdhtml += '</td>';

												jdhtml += '<td width="50"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>';
												jdhtml += '</tr>';
									$('#jieti_discountdiv').append(jdhtml);
									layui.form.render('select');
									initcolorpicker();
								}
								</script>
								{/if}
								{if getcustom('product_field_buy')}
									<div class="layui-form-item">
										<label class="layui-form-label">规格：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[guige]" class="layui-input" value="{$info['guige']}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">品牌：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[brand]" class="layui-input" value="{$info['brand']}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">单位：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[unit]" class="layui-input" value="{$info['unit']}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">有效期：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[valid_time]" class="layui-input" value="{$info['valid_time']}">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">备注：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[remark]" class="layui-input" value="{$info['remark']}">
										</div>
									</div>
								{/if}
								<div class="layui-form-item" id="setgg">
									<label class="layui-form-label">设置规格：</label>
									<div class="layui-input-inline" style="width:auto">
										<table id="ggnamediv"  class="layui-table" style="width:700px">
											<thead>
											<tr>
												<th>规格分组</th>
												<th>规格名称</th>
												<th>操作</th>
											</tr>
											</thead>
											{php} $guigedata = json_decode($info['guigedata']);{/php}
											{if $guigedata}
											{foreach $guigedata as $k=>$gg}
											<tr>
												<td><input type="text" class="layui-input" name="ggname" value="{$gg->title}" style="width:120px;margin-bottom: 5px;"/></td>
												<td>
													{foreach $gg->items as $k2=>$ggitem}
													<div><input type="text" name="ggnameguige"  class="layui-input"style="width:180px;margin-bottom:5px" value="{$ggitem->title}" placeholder="请输入规格名称">
														{if $k2==0}
														<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button>
														{else}
														<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" data-id="{$gg->k}" id="{$ggitem->k}" onclick="delggname(this,0)" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button>
														{/if}
														{if getcustom('product_wholesale')}
														{if $k==0}
														<div id="ggpic_wholesale{$k2}" class="jieti_discount" style="{if $info['product_type']!=4}display:none{/if}">
														<input type="hidden" name="ggpic_wholesale" id="ggpic_wholesale_val{$k2}" value="{$ggitem->ggpic_wholesale}"/>
														<div class="guigeimg" style="margin-bottom:6px;"><img class="thumb_img" src="{$ggitem->ggpic_wholesale}" style="max-width:50px;"/><a  {if $ggitem->ggpic_wholesale=='' || $ggitem->ggpic_wholesale==null}style="display: none;" {/if}  class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().find('img').attr('src','').hide();$(this).parent().prev('input').val('');getpicsval('pic','picPreview');$(this).hide();" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
														</div> <button class="layui-btn layui-btn-sm layui-btn-primary" style="margin-bottom:6px;" onclick="uploader(this)" upload-input="ggpic_wholesale_val{$k2}" upload-preview="ggpic_wholesale{$k2}" type="button">上传</button>
														{/if}
												</div>
			
												{/if}
													</div>
													{/foreach}
												</td>
												
												{if $k==0}
												<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>
												{else}
												<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>
												{/if}
											</tr>
											{/foreach}
											{else}
											<tr>
												<td><input type="text" class="layui-input" name="ggname" value="规格" style="width:120px;margin-bottom: 5px;"/></td>
												<td><div><input name="ggnameguige" type="text" class="layui-input" style="width:180px;margin-bottom:5px" value="默认规格" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button>
													{if getcustom('product_wholesale')}
													<div id="ggpic_wholesale" class="jieti_discount" style="{if $info['product_type']!=4}display:none{/if}">
														<input type="hidden" name="ggpic_wholesale" id="ggpic_wholesale_val" value=""/>
														<div class="guigeimg" style="margin-bottom:6px;" ><img class="thumb_img" src="" style="max-width:50px;"/>
															<a  style="display: none;" class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().find('img').attr('src','').hide();$(this).parent().prev('input').val('');getpicsval('pic','picPreview');$(this).hide();" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
														</div> <button class="layui-btn layui-btn-sm layui-btn-primary" style="margin-bottom:6px;"  onclick="uploader(this)" upload-input="ggpic_wholesale_val" upload-preview="ggpic_wholesale" type="button">上传</button>													
													</div>
													{/if}
													</div></td>
												

												
			
												
												<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>
											</tr>
											{/if}
										</table>
										<div class="layui-word-aux">提示：先点击“添加按钮”添加规格分组，如：“颜色”，“尺码”，若只有一种规格则不需要添加规格分组；<br/>然后分别点击"＋"号添加规格名称，如：“红色”，“蓝色”；“大号”，“小号”；<br/>设置完成后点击“刷新规格项目表”按钮进行编辑各个规格的价格、库存等信息</div>
										<button type="button"  class="layui-btn layui-btn-sm layui-btn-primary" onclick="refreshgg()"><i class="fa fa-refresh" style="font-size:14px!important"></i>刷新规格项目表</button>
										{if $bid==0 || $bset['product_showset']==1}<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="lvpriceset()" id="lvpricebtn">{if $info['lvprice']==1}关闭{else}开启{/if}会员价</button>{/if}
										{if getcustom('member_level_price_rate')}{if $bid==0 || $bset['product_showset']==1}<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="lvpricesetWithRate()" id="lvpricesetWithRate"{if $info['lvprice'] == 0} style="display:none"{/if}>填充价格</button>{/if}{/if}
										<input type="hidden" name="info[lvprice]" value="{$info['id']?$info['lvprice']:'0'}"/>
										<table id="ggvaldiv" class="layui-table" style="margin-top:20px;">
										</table>
										{if $bid==0}
										<div class="layui-form-mid layui-word-aux">注：开启会员价可设置不同会员等级显示不同价格；赠{:t('积分')}确认收货才赠送，与系统设置中的消费赠送{:t('积分')}(支付就赠送{:t('积分')})兼得</div>
										{/if}
										<input type="hidden" name="specs" value=""/>
									</div>
								</div>
								{if getcustom('discount_code_zhongchuang')}
								<div class="layui-form-item">
									<div class="layui-form-label">优惠码价格：</div>
									<div class="layui-input-inline">
										<input class="layui-input" name="info[price_discount_code_zc]" value="{$info.price_discount_code_zc}"/>
									</div>
									<div class="layui-form-mid layui-word-aux">中创优惠码</div>
								</div>
								{/if}
								{if getcustom('product_givescore_time') && ($bid==0 || $business_selfscore==1)}
								<div class="layui-form-item">
									<label class="layui-form-label">积分赠送时间：</label>
									<div class="layui-input-inline" style="width:500px">
										<input type="radio" name="info[givescore_time]" value="0" title="确认收货后" {if !$info['id'] || $info['givescore_time']==0}checked{/if} lay-filter=""/>
										<input type="radio" name="info[givescore_time]" value="1" title="付款后" {if $info['id'] && $info['givescore_time']==1}checked{/if} lay-filter=""/>
									</div>
								</div>
								{/if}
								<div class="layui-form-item">
									<label class="layui-form-label">价格模式：</label>
									<div class="layui-input-inline" style="width:260px;overflow: hidden;">
										<input type="radio" name="info[price_type]" value="0" title="默认" {if !$info['id'] || $info['price_type']==0}checked{/if} lay-filter="price_type"/>
										<input type="radio" name="info[price_type]" value="1" title="询价" {if $info['id'] && $info['price_type']==1}checked{/if} lay-filter="price_type"/>
										{if getcustom('shop_other_infor')}
										<input type="text" name="info[xunjia_text]" id="xunjia_text" lay-verType="tips" class="layui-input" style="width: 100px;float: right;" value="{$info['xunjia_text']?$info['xunjia_text']:'联系TA'}">
										{/if}
									</div>
									<div class="layui-form-mid layui-word-aux">默认：展示售价，详情页展示购买和加入购物车，可下单；询价：不设置售价时不展示，详情页展示联系按钮（点击展示系统设置的商家名称和服务电话），不可下单。</div>
								</div>
								{if getcustom('product_xunjia_btn')}
								<div id="xunjia_item" {if $info.price_type!=1}style="display:none;"{/if}>
									<hr>
									<div class="layui-form-item">
										<label class="layui-form-label">联系Ta：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[show_xunjia_btn]" value="1" {if !$info['show_xunjia_btn'] || $info['show_xunjia_btn']==1}checked{/if} title="显示" lay-filter="show_xunjia_btn" />
											<input type="radio" name="info[show_xunjia_btn]" value="0" {if $info['show_xunjia_btn']===0}checked{/if} title="不显示" lay-filter="show_xunjia_btn" />
										</div>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">商品详情页，咨询商品，是否显示咨询按钮以及设置按钮文案</div>
									</div>
									<div id="xunjia_btn_txt" {if $info.id && $info.show_xunjia_btn!=1}style="display:none;"{/if}>
										<div class="layui-form-item">
											<label class="layui-form-label">联系Ta文字：</label>
											<div class="layui-input-inline">
												<input type="text" class="layui-input" name="info[xunjia_text]" value="{$info.xunjia_text|default='联系TA'}"/>
											</div>
											<div class="layui-form-mid layui-word-aux">联系Ta文本</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">联系Ta背景色：</label>
											<div class="layui-input-inline">
												<input type="text" name="info[xunjia_btn_bgcolor]" value="{$info.xunjia_btn_bgcolor|default='#FE9800'}" class="layui-input">
											</div>
											<div class="_colorpicker" style="float:left"></div>
											<div class="layui-form-mid layui-word-aux">如：#FE9800</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">联系Ta字体色：</label>
											<div class="layui-input-inline">
												<input type="text" name="info[xunjia_btn_color]" value="{$info.xunjia_btn_color|default='#FFFFFF'}" class="layui-input">
											</div>
											<div class="_colorpicker" style="float:left"></div>
											<div class="layui-form-mid layui-word-aux">如：#FFFFFF</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">联系Ta链接：</label>
											<div class="layui-input-inline" style="width:30%;">
												<input type="text" id="xunjia_btn_url" name="info[xunjia_btn_url]" value="{$info['xunjia_btn_url']}" class="layui-input">
											</div>
											<div class="layui-input-inline"><button class="layui-btn" onclick="showChooseContactLink('xunjia_btn_url')">选择链接</button></div>
										</div>
									</div>
									<hr>
								</div>
								{/if}
								{if getcustom('shopproduct_rewardedvideoad') && in_array('wx',$platform)}
								<div class="layui-form-item">
									<label class="layui-form-label">小程序激励广告：</label>
									<div class="layui-input-inline">
										<input type="text" name="info[rewardedvideoad]" class="layui-input" value="{$info['rewardedvideoad']}">
									</div>
									<div class="layui-form-mid layui-word-aux">填写广告位ID 在小程序后台"流量主-广告管理-激励广告"中查找，设置后进入商品详情页必须先看完激励广告视频</div>
								</div>
								{/if}


								{if getcustom('freight_selecthxbids') && $bid==0}
								<div class="layui-form-item">
									<label class="layui-form-label">计次商品：</label>
									<div class="layui-input-inline" style="width:260px;overflow: hidden;">
										<input type="radio" name="info[isjici]" value="0" title="否" {if !$info['id'] || $info['isjici']==0}checked{/if}/>
										<input type="radio" name="info[isjici]" value="1" title="是" {if $info['id'] && $info['isjici']==1}checked{/if}/>
									</div>
									<div class="layui-form-mid layui-word-aux"></div>
								</div>
								{/if}
								<div class="layui-form-item">
									<label class="layui-form-label">配送模板：</label>
									<div class="layui-input-inline" style="width:500px">
										<input type="radio" name="info[freighttype]" value="1" title="全部模板" {if !$info['id'] || $info['freighttype']==1}checked{/if} lay-filter="freighttypeset"/>
										<input type="radio" name="info[freighttype]" value="0" title="选择模板" {if $info['id'] && $info['freighttype']==0}checked{/if} lay-filter="freighttypeset"/>
										<input type="radio" name="info[freighttype]" value="3" title="自动发货" {if $info['id'] && $info['freighttype']==3}checked{/if} lay-filter="freighttypeset"/>
										<input type="radio" name="info[freighttype]" value="4" title="在线卡密" {if $info['id'] && $info['freighttype']==4}checked{/if} lay-filter="freighttypeset"/>
									</div>

									<div id="freighttype3" style="{if $info['freighttype']!=3}display:none{/if}">
										<div class="layui-form-item">
											<label class="layui-form-label"></label>
											<div class="layui-input-inline" style="width:500px">
												<textarea type="text" name="info[freightcontent]" placeholder="请输入发货信息" class="layui-textarea">{$info.freightcontent}</textarea>
											</div>
										</div>
									</div>
									<div id="freighttype4" style="{if $info['freighttype']!=4}display:none{/if}">
										<div class="layui-form-item">
											<label class="layui-form-label"></label>
											<div class="layui-form-mid">请保存商品信息后在商品列表中上传卡密信息；用户购买几件将发送几个卡密信息</div>
										</div>
									</div>

									<div id="setfreight" style="clear:both;{if !$info['id'] || $info['freighttype']!=0}display:none{/if}">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline" style="width:auto">
											<table id="setfreightdiv"  class="layui-table" style="width:500px">
												<thead>
												<tr>
													<th>模板ID</th>
													<th>模板名称</th>
													<th>操作</th>
												</tr>
												</thead>

												{if $freightdata}
												{foreach $freightdata as $k=>$ff}
												<tr class="freightlisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,{$ff.id})">删除</button></td></tr>
												{/foreach}
												{/if}
												<tr id="freightaddtr">
													<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseFreight()">添加</button></td>
												</tr>
											</table>
											<input type="hidden" name="info[freightdata]" value="{$info.freightdata}"/>
										</div>
									</div>
								</div>
								<script>
									var chooseFreightLayer;
									function showChooseFreight(){ //
										chooseFreightLayer = layer.open({type:2,title:'选择配送模板',content:"{:url('Freight/choosefreight')}&bid={$info.bid}",area:['1000px','600px'],shadeClose:true});
									}
									function chooseFreight(fid,fname){
										layer.close(chooseFreightLayer);
										var freightlistids = [];
										var isadd = 0;
										$('.freightlisttr').each(function(){
											var thisfid = $(this).find('td:eq(0)').html();
											if(thisfid == fid){
												isadd = 1
												dialog('该配送模板已添加过了');
											}
											freightlistids.push(thisfid)
										})
										if(isadd == 0){
											freightlistids.push(fid)
											$("input[name='info[freightdata]']").val(freightlistids.join(','));
											$('#freightaddtr').before('<tr class="freightlisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,'+fid+')">删除</button></td></tr>');
										}
										console.log(freightlistids)
									}
									function delfreight(obj,fid){
										$(obj).parent().parent().remove();
										var freightlistids = [];
										$('.freightlisttr').each(function(){
											freightlistids.push($(this).find('td:eq(0)').html())
										})
										$("input[name='info[freightdata]']").val(freightlistids.join(','));
									}
								</script>
								
								{if getcustom('weight_template')}
								<div class="layui-form-item">
									<label class="layui-form-label">{:t('包装费')}：</label>
									<div class="layui-input-inline" style="width:500px">
										<input type="radio" name="info[weighttype]" value="1" title="全部模板" {if !$info['id'] || $info['weighttype']==1}checked{/if} lay-filter="weighttype"/>
										<input type="radio" name="info[weighttype]" value="2" title="选择模板" {if $info['id'] && $info['weighttype']==2}checked{/if} lay-filter="weighttype"/>
										<input type="radio" name="info[weighttype]" value="0" title="关闭" {if $info['id'] && $info['weighttype']==0}checked{/if} lay-filter="weighttype"/>
									</div>

									<div id="setweight" style="clear:both;{if !$info['id'] || $info['weighttype']!=2}display:none{/if}">
										<label class="layui-form-label"></label>
										<div class="layui-input-inline" style="width:auto">
											<table id="setfreightdiv"  class="layui-table" style="width:500px">
												<thead>
												<tr>
													<th>模板ID</th>
													<th>模板名称</th>
													<th>操作</th>
												</tr>
												</thead>

												{if $weightdata}
												{foreach $weightdata as $k=>$ff}
												<tr class="weightlisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,{$ff.id})">删除</button></td></tr>
												{/foreach}
												{/if}
												<tr id="weightaddtr">
													<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseWeight()">添加</button></td>
												</tr>
											</table>
											<input type="hidden" name="info[weightdata]" value="{$info.weightdata}"/>
										</div>
									</div>
								</div>
								<script>
									var chooseWeghtLayer;
									function showChooseWeight(){ //
										chooseWeghtLayer = layer.open({type:2,title:'选择重量模板',content:"{:url('ShopWeightTemplate/chooseweight')}&bid={$info.bid}",area:['1000px','600px'],shadeClose:true});
									}
									function chooseWeight(fid,fname){
										layer.close(chooseWeghtLayer);
										var weightlistids = [];
										var isadd = 0;
										$('.weightlisttr').each(function(){
											var thisfid = $(this).find('td:eq(0)').html();
											if(thisfid == fid){
												isadd = 1
												dialog('该重量模板已添加过了');
											}
											weightlistids.push(thisfid)
										})
										if(isadd == 0){
											weightlistids.push(fid)
											$("input[name='info[weightdata]']").val(weightlistids.join(','));
											$('#weightaddtr').before('<tr class="weightlisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delweight(this,'+fid+')">删除</button></td></tr>');
										}
										console.log(weightlistids)
									}
									function delweight(obj,fid){
										$(obj).parent().parent().remove();
										var weightlistids = [];
										$('.weightlisttr').each(function(){
											weightlistids.push($(this).find('td:eq(0)').html())
										})
										$("input[name='info[weightdata]']").val(weightlistids.join(','));
									}
								</script>
								{/if}
	
								{if $bid==0 || $bset['commission_canset']==1}
								<div class="layui-form-item">
									<label class="layui-form-label">分销设置：</label>
									<div class="layui-input-block">
										<input type="radio" name="info[commissionset]" value="0" {if !$info['id'] || $info['commissionset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="commissionset">
										<input type="radio" name="info[commissionset]" value="1" {if $info['commissionset']==1}checked{/if} title="单独设置提成比例" lay-filter="commissionset">
										<input type="radio" name="info[commissionset]" value="2" {if $info['commissionset']==2}checked{/if} title="单独设置提成金额" lay-filter="commissionset">
										{if $bid==0}
										<input type="radio" name="info[commissionset]" value="3" {if $info['commissionset']==3}checked{/if} title="分销送{:t('积分')}" lay-filter="commissionset">
										{if getcustom('commission_score_percent')}<input type="radio" name="info[commissionset]" value="7" {if $info['commissionset']==7}checked{/if} title="分销按比例送{:t('积分')}" lay-filter="commissionset">{/if}
										<input type="radio" name="info[commissionset]" value="5" {if $info['commissionset']==5}checked{/if} title="提成比例+{:t('积分')}" lay-filter="commissionset">
										<input type="radio" name="info[commissionset]" value="6" {if $info['commissionset']==6}checked{/if} title="提成金额+{:t('积分')}" lay-filter="commissionset">
										{/if}
										<!-- <span {if $info['lvprice']==0}style="display:none"{/if} id="commissionset4input">
                                        <input type="radio" name="info[commissionset]" value="4" {if $info['commissionset']==4}checked{/if} title="按差价拿{:t('佣金')}" lay-filter="commissionset">
                                        </span> -->
										<input type="radio" name="info[commissionset]" value="-1" {if $info['commissionset']==-1}checked{/if} title="不参与分销" lay-filter="commissionset">
									</div>
									<div class="layui-form-mid layui-word-aux">按照{:t('会员')}等级：按照{:t('会员')}等级中设置的提成比例进行提成分配，提成=对应{:t('会员')}等级的提成比例×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成比例：按照单独设置的提成比例进行提成分配，提成=设置的百分比×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成金额：按照单独设置的提成金额进行提成分配，提成=提成金额×购买数量<br>
										分销送{:t('积分')}：分销提成不给{:t('佣金')}而是给{:t('积分')}，得到的积分=提成{:t('积分')}×购买数量<br>
										{if getcustom('commission_score_percent')}
										分销按比例送{:t('积分')}：分销提成不给{:t('佣金')}而是给{:t('积分')}，得到的积分=设置的百分比×{$jiesuantypeDesc}×购买数量，四舍五入取整<br>
										{/if}
										* 当商家开启独立收款并且开启商家返款扣除分销佣金时，提成金额比例+平台抽成金额比例不能超过30%（微信支付分账限制）
										<!-- <span id="commissionset4tips" {if $info['lvprice']==0}style="display:none"{/if}>按差价拿{:t('佣金')}：当开启会员价时，不同的会员等级存在价格差，如果上级与下级之间存在价格差，则此价格差作为{:t('佣金')}返给上级</span> -->
									</div>
								</div>
								{php}
								$commissiondata1 = json_decode($info['commissiondata1'],true);
								if(!$commissiondata1) $commissiondata1 = [];
								$commissiondata2 = json_decode($info['commissiondata2'],true);
								if(!$commissiondata2) $commissiondata2 = [];
								$commissiondata3 = json_decode($info['commissiondata3'],true);
								if(!$commissiondata3) $commissiondata3 = [];
								$commissiondata4 = json_decode($info['commissiondata4'],true);
								if(!$commissiondata4) $commissiondata4 = [];
								{/php}
								<div id="commissionset1" {if $info['commissionset']!=1 && $info['commissionset']!=5}style="display:none"{/if}>
								{if !$aglevellist}
								<div class="layui-form-item">
									<label class="layui-form-label">提成比例：</label>
									<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
								</div>
								{else}
								{foreach $aglevellist as $level}
								<div class="layui-form-item">
									<label class="layui-form-label">{$level.name}：</label>
									<div class="layui-input-inline layui-module-itemL">
										<div> 一级(%) </div>
										<input type="text" name="commissiondata1[{$level.id}][commission1]" class="layui-input" value="{$commissiondata1[$level['id']]['commission1']}">
									</div>
									{if $level['can_agent']>1}
									<div class="layui-input-inline layui-module-itemL">
										<div>二级(%)</div>
										<input type="text" name="commissiondata1[{$level.id}][commission2]" class="layui-input" value="{$commissiondata1[$level['id']]['commission2']}">
									</div>
									{/if}
									{if $level['can_agent']>2}
									<div class="layui-input-inline layui-module-itemL">
										<div>三级(%)</div>
										<input type="text" name="commissiondata1[{$level.id}][commission3]" class="layui-input" value="{$commissiondata1[$level['id']]['commission3']}">
									</div>
									{/if}
								</div>
								{/foreach}
								{/if}
							</div>
							<div id="commissionset2" {if $info['commissionset']!=2 && $info['commissionset']!=6}style="display:none"{/if}>
							{if !$aglevellist}
							<div class="layui-form-item">
								<label class="layui-form-label">提成金额：</label>
								<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
							</div>
							{else}
							{foreach $aglevellist as $level}
							<div class="layui-form-item">
								<label class="layui-form-label">{$level.name}：</label>
								<div class="layui-input-inline layui-module-itemL">
									<div> 一级(元) </div>
									<input type="text" name="commissiondata2[{$level.id}][commission1]" class="layui-input" value="{$commissiondata2[$level['id']]['commission1']}">
								</div>
								{if $level['can_agent']>1}
								<div class="layui-input-inline layui-module-itemL">
									<div>二级(元)</div>
									<input type="text" name="commissiondata2[{$level.id}][commission2]" class="layui-input" value="{$commissiondata2[$level['id']]['commission2']}">
								</div>
								{/if}
								{if $level['can_agent']>2}
								<div class="layui-input-inline layui-module-itemL">
									<div>三级(元)</div>
									<input type="text" name="commissiondata2[{$level.id}][commission3]" class="layui-input" value="{$commissiondata2[$level['id']]['commission3']}">
								</div>
								{/if}
							</div>
							{/foreach}
							{/if}
							{if getcustom('fengdanjiangli')}
							<div class="layui-form-item">
								<label class="layui-form-label">逢单奖励：</label>
								<div class="layui-input-inline" style="width:210px;">
									<input type="text" name="info[fengdanjiangli]" class="layui-input" value="{$info.fengdanjiangli}">
								</div>
								<div class="layui-form-mid layui-word-aux">即尾数为第几单给奖励,用英文逗号","分割,如:3,6,9</div>
							</div>
							{/if}
						</div>
						<div id="commissionset3" {if $info['commissionset']!=3 && $info['commissionset']!=5 && $info['commissionset']!=6}style="display:none"{/if}>
						{if !$aglevellist}
						<div class="layui-form-item">
							<label class="layui-form-label">提成{:t('积分')}：</label>
							<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
						</div>
						{else}
						{foreach $aglevellist as $level}
						<div class="layui-form-item">
							<label class="layui-form-label">{$level.name}：</label>
							<div class="layui-input-inline layui-module-itemL">
								<div> 一级({:t('积分')}) </div>
								<input type="text" name="commissiondata3[{$level.id}][commission1]" class="layui-input" value="{$commissiondata3[$level['id']]['commission1']}">
							</div>
							{if $level['can_agent']>1}
							<div class="layui-input-inline layui-module-itemL">
								<div>二级({:t('积分')})</div>
								<input type="text" name="commissiondata3[{$level.id}][commission2]" class="layui-input" value="{$commissiondata3[$level['id']]['commission2']}">
							</div>
							{/if}
							{if $level['can_agent']>2}
							<div class="layui-input-inline layui-module-itemL">
								<div>三级({:t('积分')})</div>
								<input type="text" name="commissiondata3[{$level.id}][commission3]" class="layui-input" value="{$commissiondata3[$level['id']]['commission3']}">
							</div>
							{/if}
						</div>
						{/foreach}
						{/if}
					</div>
					{if getcustom('commission_score_percent')}
					<div id="commissionset4" {if $info['commissionset']!=7}style="display:none"{/if}>
					{if !$aglevellist}
					<div class="layui-form-item">
						<label class="layui-form-label">提成{:t('积分')}比例：</label>
						<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
					</div>
					{else}
					{foreach $aglevellist as $level}
					<div class="layui-form-item">
						<label class="layui-form-label">{$level.name}：</label>
						<div class="layui-input-inline layui-module-itemL">
							<div> 一级({:t('积分')}%) </div>
							<input type="text" name="commissiondata4[{$level.id}][commission1]" class="layui-input" value="{$commissiondata4[$level['id']]['commission1']}">
						</div>
						{if $level['can_agent']>1}
						<div class="layui-input-inline layui-module-itemL">
							<div>二级({:t('积分')}%)</div>
							<input type="text" name="commissiondata4[{$level.id}][commission2]" class="layui-input" value="{$commissiondata4[$level['id']]['commission2']}">
						</div>
						{/if}
						{if $level['can_agent']>2}
						<div class="layui-input-inline layui-module-itemL">
							<div class="layui-form-mid">三级({:t('积分')}%)</div>
							<input type="text" name="commissiondata4[{$level.id}][commission3]" class="layui-input" value="{$commissiondata4[$level['id']]['commission3']}">
						</div>
						{/if}
					</div>
					{/foreach}
					{/if}
				</div>
				{/if}
				{if getcustom('commission_butie')}
				<div id="commission_butie" {if !in_array($info['commissionset'],[2,6])}style="display:none"{/if}>
				<div class="layui-form-item">
					<label class="layui-form-label">分期发放金额：</label>
				</div>
				<div class="layui-form-item">
					{if !$aglevellist}
					<div class="layui-form-item">
						<label class="layui-form-label"></label>
						<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
					</div>
					{else}
					{foreach $aglevellist as $level}
					<div class="layui-form-item">
						<label class="layui-form-label">{$level.name}：</label>
						<div class="layui-input-inline layui-module-itemL">
							<div> 一级 </div>
							<input type="text" name="commissionbutie[{$level.id}][commission1]" class="layui-input" value="{$commissionbutie[$level['id']]['commission1']}">
						</div>
						{if $level['can_agent']>1}
						<div class="layui-input-inline layui-module-itemL">
							<div>二级</div>
							<input type="text" name="commissionbutie[{$level.id}][commission2]" class="layui-input" value="{$commissionbutie[$level['id']]['commission2']}">
						</div>
						{/if}
						{if $level['can_agent']>2}
						<div class="layui-input-inline layui-module-itemL">
							<div class="layui-form-mid">三级</div>
							<input type="text" name="commissionbutie[{$level.id}][commission3]" class="layui-input" value="{$commissionbutie[$level['id']]['commission3']}">
						</div>
						{/if}
					</div>
					{/foreach}
					{/if}
					<div class="layui-form-mid layui-word-aux layui-input-block">
						获得分销提成按照《系统设置》->《分销分红》->《分销补贴》处设置分期发放
					</div>
				</div>
				</div>
				<div id="commission_butie2" {if !in_array($info['commissionset'],[1,5])}style="display:none"{/if}>
				<div class="layui-form-item">
					<label class="layui-form-label">分期发放比例：</label>
				</div>
				<div class="layui-form-item">
					{if !$aglevellist}
					<div class="layui-form-item">
						<label class="layui-form-label">提成{:t('积分')}比例：</label>
						<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
					</div>
					{else}
					{foreach $aglevellist as $level}
					<div class="layui-form-item">
						<label class="layui-form-label">{$level.name}：</label>
						<div class="layui-input-inline layui-module-itemL">
							<div> 一级(%) </div>
							<input type="text" name="commissionbutie2[{$level.id}][commission1]" class="layui-input" value="{$commissionbutie2[$level['id']]['commission1']}">
						</div>
						{if $level['can_agent']>1}
						<div class="layui-input-inline layui-module-itemL">
							<div>二级(%)</div>
							<input type="text" name="commissionbutie2[{$level.id}][commission2]" class="layui-input" value="{$commissionbutie2[$level['id']]['commission2']}">
						</div>
						{/if}
						{if $level['can_agent']>2}
						<div class="layui-input-inline layui-module-itemL">
							<div class="layui-form-mid">三级(%)</div>
							<input type="text" name="commissionbutie2[{$level.id}][commission3]" class="layui-input" value="{$commissionbutie2[$level['id']]['commission3']}">
						</div>
						{/if}
					</div>
					{/foreach}
					{/if}
					<div class="layui-form-mid layui-word-aux layui-input-block">
						获得分销提成按照《系统设置》->《分销分红》->《分销补贴》处设置分期发放
					</div>
				</div>
				</div>
				{/if}
				{if getcustom('commission_jicha')}
				<div class="layui-form-item">
					<label class="layui-form-label">分销级差：</label>
					<div class="layui-input-block" >
						<input type="radio" name="info[fx_differential]" title="跟随系统设置" value="-1" {if $info['fx_differential']==-1 || $info['fx_differential']==''}checked{/if}/>
						<input type="radio" name="info[fx_differential]" title="是" value="1" {if $info['fx_differential']==1}checked{/if}/>
						<input type="radio" name="info[fx_differential]" title="否" value="0" {if $info['fx_differential']=='0'}checked{/if}/>
					</div>
					<div class="layui-form-mid layui-word-aux">开启后分销将按照级差进行计算，仅限按金额和比例方式</div>
				</div>
				{/if}
				{if getcustom('commission_parent_pj_stop_product') }
				<div class="layui-form-item">
					<label class="layui-form-label">提成平级奖</label>
					<div class="layui-input-block" >
						<input type="radio" name="info[commission_parent_pj_status]" value="0" title="按会员等级" {if $info['commission_parent_pj_status']==0}checked{/if}  lay-filter="commissionpj">
						<input type="radio" name="info[commission_parent_pj_status]" value="1" title="单独设置" {if $info['commission_parent_pj_status']==1}checked{/if}  lay-filter="commissionpj">
						<input type="radio" name="info[commission_parent_pj_status]" value="-1" title="关闭" {if $info['commission_parent_pj_status']==-1}checked{/if}  lay-filter="commissionpj">
					</div>
					<div class="layui-input-inline layui-module-itemL commissionpj" style="{if $info['commission_parent_pj_status']==0}display:none;{/if}">
						<div>平级级数</div>
						<input   type="text" name="info[commission_parent_pj_lv]" class="layui-input" value="{$info.commission_parent_pj_lv|default=0}">
					</div>
					<div class="layui-input-inline layui-module-itemL commissionpj" style="{if $info['commission_parent_pj_status']==0}display:none;{/if}">
						<div>平级奖(元)</div>
						<input   type="text" name="info[commission_parent_pj]" class="layui-input" value="{$info.commission_parent_pj}">
					</div>
					<div class="layui-input-inline layui-module-itemL commissionpj" style="{if $info['commission_parent_pj_status']==0}display:none;{/if}">
						<div>支付金额比例(%)</div>
						<input   type="text" name="info[commission_parent_pj_order]" class="layui-input" value="{$info.commission_parent_pj_order}">
					</div>
					<div class="layui-form-mid layui-word-aux layui-clear">
						1、开启平级奖后推荐人级别和下级相等时只发放平级奖不发放提成<br/>
						2、开启平级奖后推荐人级别小于下级不发放提成<br/>
						3、平级级数代表处理团队多少级以内的会员，超出级数不再发放奖金，0表示不限制
					</div>
				</div>
				{/if}

				{if getcustom('commission_parent_pj') && !getcustom('commission_parent_pj_stop')}
				<div class="layui-form-item">
					<label class="layui-form-label">平级奖：</label>
					<div class="layui-input-block" style="width:700px">
						<input type="radio" name="info[commissionpingjiset]" value="0" {if !$info['id'] || $info['commissionpingjiset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="commissionpingjiset">
						<input type="radio" name="info[commissionpingjiset]" value="1" {if $info['commissionpingjiset']==1}checked{/if} title="单独设置奖励比例" lay-filter="commissionpingjiset">
						<input type="radio" name="info[commissionpingjiset]" value="2" {if $info['commissionpingjiset']==2}checked{/if} title="单独设置奖励金额" lay-filter="commissionpingjiset">
						<input type="radio" name="info[commissionpingjiset]" value="-1" {if $info['commissionpingjiset']==-1}checked{/if} title="不参与平级奖" lay-filter="commissionpingjiset">
					</div>
					<div class="layui-form-mid layui-word-aux">下级等级和自己等级相同时拿下级分销金额的奖励百分比或奖励金额，只给最近的上级</div>
				</div>
				{php}
				$commissionpingjidata1 = json_decode($info['commissionpingjidata1'],true);
				if(!$commissionpingjidata1) $commissionpingjidata1 = [];
				$commissionpingjidata2 = json_decode($info['commissionpingjidata2'],true);
				if(!$commissionpingjidata2) $commissionpingjidata2  = [];
				{/php}
				<div id="commissionpingjiset1" {if $info['commissionpingjiset']!=1}style="display:none"{/if}>
				<div class="layui-form-item">
					<label class="layui-form-label">奖励比例：</label>
					{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>{/if}
					{foreach $aglevellist as $level}
					<div class="layui-input-inline layui-module-itemL">
						<div> {$level.name}(%) </div>
						<input type="text" name="commissionpingjidata1[{$level.id}][commission]" class="layui-input" value="{$commissionpingjidata1[$level['id']]['commission']}">
					</div>
					{/foreach}
				</div>
			</div>
			<div id="commissionpingjiset2" {if $info['commissionpingjiset']!=2}style="display:none"{/if}>
			<div class="layui-form-item">
				<label class="layui-form-label">奖励金额：</label>
				{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
				{foreach $aglevellist as $level}
				<div class="layui-input-inline layui-module-itemL">
					<div> {$level.name}(元) </div>
					<input type="text" name="commissionpingjidata2[{$level.id}][commission]" class="layui-input" value="{$commissionpingjidata2[$level['id']]['commission']}">
				</div>
				{/foreach}
			</div>
		</div>
		{/if}
<!--************************直推平级奖start 20231115******************************-->
{if getcustom('zhitui_pj') }
<div class="layui-form-item">
	<label class="layui-form-label">直推平级奖：</label>
	<div class="layui-form-mid">
		推荐相同等级会员购物奖励<br/>
	</div>
</div>
{foreach $levellist as $level}
<div class="layui-form-item">
	<label class="layui-form-label"></label>
	<div class="layui-input-inline layui-module-itemL">
		<div>{$level['name']}推荐{$level['name']}</div>
		<input   type="text" name="info[zhitui_pj][{$level.id}]" class="layui-input" value="{$zhitui_pj[$level['id']]|default=0}">元
	</div>


</div>
{/foreach}
{/if}
<!--************************直推平级奖end 20231115******************************-->

		<!--***********************************购车基金 start***************************************-->
		{if getcustom('teamfenhong_gouche')}
		<div class="layui-form-item">
			<label class="layui-form-label">{:t('购车基金')}：</label>
			<div class="layui-input-block" style="width:700px">
				<input type="radio" name="info[gouchebonusset]" value="0" {if !$info['id'] || $info['gouchebonusset']==0}checked{/if} title="不参与{:t('购车基金')}" lay-filter="gouchebonusset">
				<input type="radio" name="info[gouchebonusset]" value="1" {if $info['gouchebonusset']==1}checked{/if} title="单独设置奖励比例" lay-filter="gouchebonusset">
				<input type="radio" name="info[gouchebonusset]" value="2" {if $info['gouchebonusset']==2}checked{/if} title="单独设置奖励金额" lay-filter="gouchebonusset">
			</div>
			<div class="layui-form-mid layui-word-aux">拿团队分红的同时根据等级分销{:t('购车基金')}条件拿奖励</div>
		</div>
		{php}
		$gouchebonusdata1 = json_decode($info['gouchebonusdata1'],true);
		if(!$gouchebonusdata1) $gouchebonusdata1 = [];
		$gouchebonusdata2 = json_decode($info['gouchebonusdata2'],true);
		if(!$gouchebonusdata2) $gouchebonusdata2  = [];
		{/php}
		<div id="gouchebonusset1" {if $info['gouchebonusset']!=1}style="display:none"{/if}>
		<div class="layui-form-item">
			<label class="layui-form-label">奖励比例：</label>
			{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>{/if}
			{foreach $aglevellist as $level}
			<div class="layui-input-inline layui-module-itemL">
				<div> {$level.name}(%) </div>
				<input type="text" name="gouchebonusdata1[{$level.id}][commission]" class="layui-input" value="{$gouchebonusdata1[$level['id']]['commission']}">
			</div>
			{/foreach}
		</div>
	</div>
	<div id="gouchebonusset2" {if $info['gouchebonusset']!=2}style="display:none"{/if}>
	<div class="layui-form-item">
		<label class="layui-form-label">奖励金额：</label>
		{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
		{foreach $aglevellist as $level}
		<div class="layui-input-inline layui-module-itemL">
			<div> {$level.name}(元) </div>
			<input type="text" name="gouchebonusdata2[{$level.id}][commission]" class="layui-input" value="{$gouchebonusdata2[$level['id']]['commission']}">
		</div>
		{/foreach}
	</div>
</div>
{/if}
<!--***********************************购车基金 end***************************************-->


<!--***********************************旅游基金 start***************************************-->
{if getcustom('teamfenhong_lvyou')}
<div class="layui-form-item">
	<label class="layui-form-label">{:t('旅游基金')}：</label>
	<div class="layui-input-block" style="width:700px">
		<input type="radio" name="info[lvyoubonusset]" value="0" {if !$info['id'] || $info['lvyoubonusset']==0}checked{/if} title="不参与{:t('旅游基金')}" lay-filter="lvyoubonusset">
		<input type="radio" name="info[lvyoubonusset]" value="1" {if $info['lvyoubonusset']==1}checked{/if} title="单独设置奖励比例" lay-filter="lvyoubonusset">
		<input type="radio" name="info[lvyoubonusset]" value="2" {if $info['lvyoubonusset']==2}checked{/if} title="单独设置奖励金额" lay-filter="lvyoubonusset">
	</div>
	<div class="layui-form-mid layui-word-aux">拿团队分红的同时根据等级分销{:t('旅游基金')}条件拿奖励</div>
</div>
{php}
$lvyoubonusdata1 = json_decode($info['lvyoubonusdata1'],true);
if(!$lvyoubonusdata1) $lvyoubonusdata1 = [];
$lvyoubonusdata2 = json_decode($info['lvyoubonusdata2'],true);
if(!$lvyoubonusdata2) $lvyoubonusdata2  = [];
{/php}
<div id="lvyoubonusset1" {if $info['lvyoubonusset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励比例：</label>
	{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>{/if}
	{foreach $aglevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="lvyoubonusdata1[{$level.id}][commission]" class="layui-input" value="{$lvyoubonusdata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div id="lvyoubonusset2" {if $info['lvyoubonusset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励金额：</label>
	{if !$aglevellist}<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $aglevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="lvyoubonusdata2[{$level.id}][commission]" class="layui-input" value="{$lvyoubonusdata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
{/if}
<!--***********************************旅游基金 end***************************************-->

<div class="layui-form-item" {if $info['lvprice']==0}style="display:none"{/if} id="commissionset4input">
<label class="layui-form-label">等级价格极差分销：</label>
<div class="layui-input-block" style="width:800px">
	<input type="radio" name="info[commissionset4]" value="0" title="关闭" {if !$info['id'] || $info['commissionset4']==0}checked{/if}>
	<input type="radio" name="info[commissionset4]" value="1" title="开启" {if $info['commissionset4']==1}checked{/if}>
</div>
<div class="layui-form-mid layui-word-aux">开启时，如果设置了不同的会员等级的价格不同，如果上级与下级之间存在价格差，则此价格差作为{:t('佣金')}返给上级</div>
</div>
{/if}

{if $bid==0 && ($auth_data=='all' || in_array('gdfenhong',$auth_data) || in_array('teamfenhong',$auth_data) || in_array('areafenhong',$auth_data))}
<div class="layui-form-item">
	<label class="layui-form-label">分红设置：</label>
	<div class="layui-input-block" style="width:800px">
		<input type="radio" name="info[fenhongset]" value="1" {if !$info['id'] || $info['fenhongset']==1}checked{/if} title="参与" lay-filter="fenhongset">
		<input type="radio" name="info[fenhongset]" value="0" {if $info['id'] && $info['fenhongset']==0}checked{/if} title="不参与" lay-filter="fenhongset">
	</div>
</div>
<div id="fenhongset" {if $info['id'] && $info['fenhongset']==0}style="display:none"{/if}>
{if $auth_data=='all' || in_array('teamfenhong',$auth_data)}
<div class="layui-form-item">
	<label class="layui-form-label">团队分红：</label>
	<div class="layui-input-block" style="width:850px">
		<input type="radio" name="info[teamfenhongset]" value="0" {if !$info['id'] || $info['teamfenhongset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongset]" value="1" {if $info['teamfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongset]" value="2" {if $info['teamfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
		{if getcustom('fenhong_score_percent')}
		<input type="radio" name="info[teamfenhongset]" value="4" {if $info['teamfenhongset']==4}checked{/if} title="单独设置分红{:t('积分')}比例" lay-filter="diandaSwitchMulti">
		{/if}
		<input type="radio" name="info[teamfenhongset]" value="-1" {if $info['teamfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例，请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
</div>
{php}
$teamfenhongdata1 = json_decode($info['teamfenhongdata1'],true);
if(!$teamfenhongdata1) $teamfenhongdata1 = [];
$teamfenhongdata2 = json_decode($info['teamfenhongdata2'],true);
if(!$teamfenhongdata2) $teamfenhongdata2  = [];
{/php}
<div diandaSwitchMulti="info[teamfenhongset]" data-val="1" {if $info['teamfenhongset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红比例：</label>
	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teamlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="teamfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongdata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[teamfenhongset]" data-val="2" {if $info['teamfenhongset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红金额：</label>
	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teamlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="teamfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongdata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
{if getcustom('fenhong_score_percent')}
<div diandaSwitchMulti="info[teamfenhongset]" data-val="4" {if $info['teamfenhongset']!=4}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红{:t('积分')}比例：</label>
	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teamlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="teamfenhongdata1[{$level.id}][score]" class="layui-input" value="{$teamfenhongdata1[$level['id']]['score']}">
	</div>
	{/foreach}
</div>
</div>
{/if}
{/if}
{if getcustom('teamfenhong_pingji') && ($auth_data == 'all' || in_array('teamfenhong_pingji',$auth_data))}
<div class="layui-form-item">
	<label class="layui-form-label">团队分红平级奖：</label>
	<div class="layui-input-block" style="width:850px">
		<input type="radio" name="info[teamfenhongpjset]" value="0" {if !$info['id'] || $info['teamfenhongpjset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongpjset]" value="1" {if $info['teamfenhongpjset']==1}checked{/if} title="单独设置奖励比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongpjset]" value="2" {if $info['teamfenhongpjset']==2}checked{/if} title="单独设置奖励金额" lay-filter="diandaSwitchMulti">
		{if getcustom('fenhong_score_percent')}
		<input type="radio" name="info[teamfenhongpjset]" value="4" {if $info['teamfenhongpjset']==4}checked{/if} title="单独设置奖励{:t('积分')}比例" lay-filter="diandaSwitchMulti">
		{/if}
		<input type="radio" name="info[teamfenhongpjset]" value="-1" {if $info['teamfenhongpjset']==-1}checked{/if} title="不参与奖励" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
</div>
{php}
$teamfenhongpjdata1 = json_decode($info['teamfenhongpjdata1'],true);
if(!$teamfenhongpjdata1) $teamfenhongpjdata1 = [];
$teamfenhongpjdata2 = json_decode($info['teamfenhongpjdata2'],true);
if(!$teamfenhongpjdata2) $teamfenhongpjdata2  = [];
{/php}
<div diandaSwitchMulti="info[teamfenhongpjset]" data-val="1" {if $info['teamfenhongpjset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励比例：</label>
	{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红平级奖权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teampjlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="teamfenhongpjdata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongpjdata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div  diandaSwitchMulti="info[teamfenhongpjset]" data-val="2" {if $info['teamfenhongpjset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励金额：</label>
	{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teampjlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="teamfenhongpjdata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongpjdata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
{if getcustom('fenhong_score_percent')}
<div diandaSwitchMulti="info[teamfenhongpjset]" data-val="4" {if $info['teamfenhongpjset']!=4}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励{:t('积分')}比例：</label>
	{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teampjlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="teamfenhongpjdata1[{$level.id}][score]" class="layui-input" value="{$teamfenhongpjdata1[$level['id']]['score']}">
	</div>
	{/foreach}
</div>
</div>
{/if}
{/if}
{if getcustom('teamfenhong_jicha')}
<div style="border: 1px dashed black;padding: 5px;">
<div id="teamfenhong_jiuqianset">
	<div class="layui-form-item">
		<label class="layui-form-label">{:t('团队级差分红')}：</label>
		<div class="layui-input-block" style="width:850px">
			<input type="radio" name="info[teamjichaset]" value="0" {if !$info['id'] || $info['teamjichaset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamjichaset]" value="1" {if $info['teamjichaset']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamjichaset]" value="2" {if $info['teamjichaset']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamjichaset]" value="-1" {if $info['teamjichaset']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
		</div>
		<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例</div>
	</div>
{php}
$teamjichadata1 = json_decode($info['teamjichadata1'],true);
if(!$teamjichadata1) $teamjichadata1 = [];
$teamjichadata2 = json_decode($info['teamjichadata2'],true);
if(!$teamjichadata2) $teamjichadata2  = [];
{/php}
	<div diandaSwitchMulti="info[teamjichaset]" data-val="1" {if $info['teamjichaset']!=1}style="display:none"{/if}>
		<div class="layui-form-item">
			<label class="layui-form-label">分红比例：</label>
		<!--	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}-->
			{foreach $teamjichalevellist as $level}
			<div class="layui-input-inline layui-module-itemL">
				<div> {$level.name}(%) </div>
				<input type="text" name="teamjichadata1[{$level.id}][commission]" class="layui-input" value="{$teamjichadata1[$level['id']]['commission']}">
			</div>
			{/foreach}
		</div>
	</div>
	<div diandaSwitchMulti="info[teamjichaset]" data-val="2" {if $info['teamjichaset']!=2}style="display:none"{/if}>
		<div class="layui-form-item">
			<label class="layui-form-label">分红金额：</label>
		<!--	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}-->
			{foreach $teamjichalevellist as $level}
			<div class="layui-input-inline layui-module-itemL">
				<div> {$level.name}(元) </div>
				<input type="text" name="teamjichadata2[{$level.id}][commission]" class="layui-input" value="{$teamjichadata2[$level['id']]['commission']}">
			</div>
			{/foreach}
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">{:t('团队级差分红')}平级奖：</label>
		<div class="layui-input-block" style="width:850px">
			<input type="radio" name="info[teamjichapjset]" value="0" {if !$info['id'] || $info['teamjichapjset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamjichapjset]" value="1" {if $info['teamjichapjset']==1}checked{/if} title="单独设置奖励比例" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamjichapjset]" value="2" {if $info['teamjichapjset']==2}checked{/if} title="单独设置奖励金额" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamjichapjset]" value="-1" {if $info['teamjichapjset']==-1}checked{/if} title="不参与奖励" lay-filter="diandaSwitchMulti">
		</div>
		<div class="layui-form-mid layui-word-aux"></div>
	</div>
{php}
$teamjichapjdata1 = json_decode($info['teamjichapjdata1'],true);
if(!$teamjichapjdata1) $teamjichapjdata1 = [];
$teamjichapjdata2 = json_decode($info['teamjichapjdata2'],true);
if(!$teamjichapjdata2) $teamjichapjdata2  = [];
{/php}
	<div diandaSwitchMulti="info[teamjichapjset]" data-val="1" {if $info['teamjichapjset']!=1}style="display:none"{/if}>
		<div class="layui-form-item">
			<label class="layui-form-label">奖励比例：</label>
			{if !$teamjichalevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红平级奖权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
			{foreach $teamjichalevellist as $level}
			<div class="layui-input-inline layui-module-itemL">
				<div> {$level.name}(%) </div>
				<input type="text" name="teamjichapjdata1[{$level.id}][commission]" class="layui-input" value="{$teamjichapjdata1[$level['id']]['commission']}">
			</div>
			{/foreach}
		</div>
	</div>
	<div  diandaSwitchMulti="info[teamjichapjset]" data-val="2" {if $info['teamjichapjset']!=2}style="display:none"{/if}>
		<div class="layui-form-item">
			<label class="layui-form-label">奖励金额：</label>
			{if !$teamjichalevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
			{foreach $teamjichalevellist as $level}
			<div class="layui-input-inline layui-module-itemL">
				<div> {$level.name}(元) </div>
				<input type="text" name="teamjichapjdata2[{$level.id}][commission]" class="layui-input" value="{$teamjichapjdata2[$level['id']]['commission']}">
			</div>
			{/foreach}
		</div>
	</div>
</div>
</div>
{/if}
{if getcustom('team_leader_fh')}
<div style="border: 1px dashed black;padding: 5px;">
	<div id="teamleader_fenhong_set">
	<div class="layui-form-item">
		<label class="layui-form-label">{:t('团队长分红')}：</label>
		<div class="layui-input-block" style="width:850px">
			<input type="radio" name="info[teamleader_fenhongset]" value="0" {if !$info['id'] || $info['teamleader_fenhongset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamleader_fenhongset]" value="1" {if $info['teamleader_fenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamleader_fenhongset]" value="2" {if $info['teamleader_fenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
			<input type="radio" name="info[teamleader_fenhongset]" value="-1" {if $info['teamleader_fenhongset']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
		</div>
		<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例</div>
	</div>
	{php}
	$teamleader_fenhongdata1 = json_decode($info['teamleader_fenhongdata1'],true);
	if(!$teamleader_fenhongdata1) $teamleader_fenhongdata1 = [];
	$teamleader_fenhongdata2 = json_decode($info['teamleader_fenhongdata2'],true);
	if(!$teamleader_fenhongdata2) $teamleader_fenhongdata2  = [];
	{/php}
	<div diandaSwitchMulti="info[teamleader_fenhongset]" data-val="1" {if $info['teamleader_fenhongset']!=1}style="display:none"{/if}>
	<div class="layui-form-item">
		<label class="layui-form-label">分红比例：</label>
		<!--	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}-->
		{foreach $teamjichalevellist as $level}
		<div class="layui-input-inline layui-module-itemL">
			<div> {$level.name}(%) </div>
			<input type="text" name="teamleader_fenhongdata1[{$level.id}][commission]" class="layui-input" value="{$teamleader_fenhongdata1[$level['id']]['commission']}">
		</div>
		{/foreach}
	</div>
</div>
<div diandaSwitchMulti="info[teamleader_fenhongset]" data-val="2" {if $info['teamleader_fenhongset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红金额：</label>
	<!--	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}-->
	{foreach $teamjichalevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="teamleader_fenhongdata2[{$level.id}][commission]" class="layui-input" value="{$teamleader_fenhongdata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>

</div>
</div>
{/if}
{if getcustom('teamfenhong_bole') && ($auth_data=='all' || in_array('teamfenhong_bole',$auth_data))}
<div class="layui-form-item">
	<label class="layui-form-label">团队分红伯乐奖：</label>
	<div class="layui-input-block" style="width:700px">
		<input type="radio" name="info[teamfenhongblset]" value="0" {if !$info['id'] || $info['teamfenhongblset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongblset]" value="1" {if $info['teamfenhongblset']==1}checked{/if} title="单独设置奖励比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongblset]" value="2" {if $info['teamfenhongblset']==2}checked{/if} title="单独设置奖励金额" lay-filter="diandaSwitchMulti">

		<input type="radio" name="info[teamfenhongblset]" value="-1" {if $info['teamfenhongblset']==-1}checked{/if} title="不参与奖励" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
</div>
{php}
$teamfenhongbldata1 = json_decode($info['teamfenhongbldata1'],true);
if(!$teamfenhongbldata1) $teamfenhongbldata1 = [];
$teamfenhongbldata2 = json_decode($info['teamfenhongbldata2'],true);
if(!$teamfenhongbldata2) $teamfenhongbldata2  = [];
{/php}
<div diandaSwitchMulti="info[teamfenhongblset]" data-val="1" {if $info['teamfenhongblset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励比例：</label>
	{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红平级奖权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teampjlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="teamfenhongbldata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongbldata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div  diandaSwitchMulti="info[teamfenhongblset]" data-val="2" {if $info['teamfenhongblset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">奖励金额：</label>
	{if !$teampjlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teampjlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="teamfenhongbldata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongbldata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
{/if}


{if $auth_data=='all' || in_array('gdfenhong',$auth_data)}
<div class="layui-form-item">
	<label class="layui-form-label">股东分红：</label>
	<div class="layui-input-block" style="width:980px">
		<input type="radio" name="info[gdfenhongset]" value="0" {if !$info['id'] || $info['gdfenhongset']==0}checked{/if} title="按照会员等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[gdfenhongset]" value="1" {if $info['gdfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[gdfenhongset]" value="2" {if $info['gdfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
		{if getcustom('gdfenhong_score')}
		<input type="radio" name="info[gdfenhongset]" value="3" {if $info['gdfenhongset']==3}checked{/if} title="单独设置分红{:t('积分')}" lay-filter="diandaSwitchMulti">
		{/if}
		{if getcustom('fenhong_score_percent')}
		<input type="radio" name="info[gdfenhongset]" value="4" {if $info['gdfenhongset']==4}checked{/if} title="单独设置分红{:t('积分')}比例" lay-filter="diandaSwitchMulti">
		{/if}
		<input type="radio" name="info[gdfenhongset]" value="-1" {if $info['gdfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">用于股东分红或合伙人分红，开启后相应等级的所有{:t('会员')}平均分摊设置的分红金额或比例</div>
</div>
{php}
$gdfenhongdata1 = json_decode($info['gdfenhongdata1'],true);
if(!$gdfenhongdata1) $gdfenhongdata1 = [];
$gdfenhongdata2 = json_decode($info['gdfenhongdata2'],true);
if(!$gdfenhongdata2) $gdfenhongdata2  = [];
{/php}
<div diandaSwitchMulti="info[gdfenhongset]" data-val="1" {if $info['gdfenhongset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红比例：</label>
	{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $gdlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="gdfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[gdfenhongset]" data-val="2" {if $info['gdfenhongset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红金额：</label>
	{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $gdlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="gdfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[gdfenhongset]" data-val="3" {if $info['gdfenhongset']!=3}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红{:t('积分')}：</label>
	{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $gdlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name} </div>
		<input type="text" name="gdfenhongdata2[{$level.id}][score]" class="layui-input" value="{$gdfenhongdata2[$level['id']]['score']}">
	</div>
	{/foreach}
</div>
</div>
<div  diandaSwitchMulti="info[gdfenhongset]" data-val="4" {if $info['gdfenhongset']!=4}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红{:t('积分')}比例：</label>
	{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $gdlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="gdfenhongdata1[{$level.id}][score]" class="layui-input" value="{$gdfenhongdata1[$level['id']]['score']}">
	</div>
	{/foreach}
</div>
</div>
{/if}
{if getcustom('fenhong_gudong_huiben')}
{if $auth_data=='all' || in_array('gdfenhong_huiben',$auth_data)}
<!--回本股东分红 start-->
<div class="layui-form-item">
	<label class="layui-form-label">{:t('回本股东分红')}：</label>
	<div class="layui-input-block" style="width:980px">
		<input type="radio" name="info[gdfenhongset_huiben]" value="0" {if !$info['id'] || $info['gdfenhongset_huiben']==0}checked{/if} title="按照会员等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[gdfenhongset_huiben]" value="1" {if $info['gdfenhongset_huiben']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[gdfenhongset_huiben]" value="2" {if $info['gdfenhongset_huiben']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[gdfenhongset_huiben]" value="-1" {if $info['gdfenhongset_huiben']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">用于{:t('回本股东分红')}或合伙人分红，开启后相应等级的所有{:t('会员')}平均分摊设置的分红金额或比例</div>
</div>
{php}
$gdfenhongdata1_huiben = json_decode($info['gdfenhongdata1_huiben'],true);
if(!$gdfenhongdata1_huiben) $gdfenhongdata1_huiben = [];
$gdfenhongdata2_huiben = json_decode($info['gdfenhongdata2_huiben'],true);
if(!$gdfenhongdata2_huiben) $gdfenhongdata2_huiben = [];
{/php}
<div diandaSwitchMulti="info[gdfenhongset_huiben]" data-val="1" {if $info['gdfenhongset_huiben']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红比例：</label>
	{if !$gdlevellist_huiben}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $gdlevellist_huiben as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="gdfenhongdata1_huiben[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata1_huiben[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[gdfenhongset_huiben]" data-val="2" {if $info['gdfenhongset_huiben']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红金额：</label>
	{if !$gdlevellist_huiben}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $gdlevellist_huiben as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="gdfenhongdata2_huiben[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata2_huiben[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<!--回本股东分红 end-->
{/if}
{/if}
{if $auth_data=='all' || in_array('areafenhong',$auth_data)}
<div class="layui-form-item">
	<label class="layui-form-label">区域代理分红：</label>
	<div class="layui-input-block" style="width:850px">
		<input type="radio" name="info[areafenhongset]" value="0" {if !$info['id'] || $info['areafenhongset']==0}checked{/if} title="按照会员等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[areafenhongset]" value="1" {if $info['areafenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[areafenhongset]" value="2" {if $info['areafenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
		{if getcustom('fenhong_score_percent')}
		<input type="radio" name="info[areafenhongset]" value="4" {if $info['areafenhongset']==4}checked{/if} title="单独设置分红{:t('积分')}比例" lay-filter="diandaSwitchMulti">
		{/if}
		<input type="radio" name="info[areafenhongset]" value="-1" {if $info['areafenhongset']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">设置分红比例或分红金额后该等级的同一个代理区域的人平均分摊所有商城内该区域的订单的分红提成比例或分红金额</div>
</div>
{php}
$areafenhongdata1 = json_decode($info['areafenhongdata1'],true);
if(!$areafenhongdata1) $areafenhongdata1 = [];
$areafenhongdata2 = json_decode($info['areafenhongdata2'],true);
if(!$areafenhongdata2) $areafenhongdata2  = [];
{/php}
<div diandaSwitchMulti="info[areafenhongset]" data-val="1" {if $info['areafenhongset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红比例：</label>
	{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $areafhlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="areafenhongdata1[{$level.id}][commission]" class="layui-input" value="{$areafenhongdata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[areafenhongset]" data-val="2" {if $info['areafenhongset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红金额：</label>
	{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $areafhlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="areafenhongdata2[{$level.id}][commission]" class="layui-input" value="{$areafenhongdata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[areafenhongset]" data-val="4" {if $info['areafenhongset']!=4}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红{:t('积分')}比例：</label>
	{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $areafhlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="areafenhongdata1[{$level.id}][score]" class="layui-input" value="{$areafenhongdata1[$level['id']]['score']}">
	</div>
	{/foreach}
</div>
</div>
{/if}
<!--团队见单分红start-->
{if getcustom('teamfenhong_jiandan') && ($auth_data=='all' || in_array('teamfenhongJiandan',$auth_data))}
<div class="layui-form-item">
	<label class="layui-form-label">团队见单分红：</label>
	<div class="layui-input-block" style="width:850px">
		<input type="radio" name="info[teamfenhongjdset]" value="0" {if !$info['id'] || $info['teamfenhongjdset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongjdset]" value="1" {if $info['teamfenhongjdset']==1}checked{/if} title="单独设置分红比例" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongjdset]" value="2" {if $info['teamfenhongjdset']==2}checked{/if} title="单独设置分红金额" lay-filter="diandaSwitchMulti">
		<input type="radio" name="info[teamfenhongjdset]" value="-1" {if $info['teamfenhongjdset']==-1}checked{/if} title="不参与分红" lay-filter="diandaSwitchMulti">
	</div>
	<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例，请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
</div>
{php}
$teamfenhongjddata1 = $info['teamfenhongjddata1']?json_decode($info['teamfenhongjddata1'],true):[];
$teamfenhongjddata2 = $info['teamfenhongjddata2']?json_decode($info['teamfenhongjddata2'],true):[];
{/php}
<div diandaSwitchMulti="info[teamfenhongjdset]" data-val="1" {if $info['teamfenhongjdset']!=1}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红比例：</label>
	{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teamjdlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(%) </div>
		<input type="text" name="teamfenhongjddata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongjddata1[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
<div diandaSwitchMulti="info[teamfenhongjdset]" data-val="2" {if $info['teamfenhongjdset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label">分红金额：</label>
	{if !$teamjdlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
	{foreach $teamjdlevellist as $level}
	<div class="layui-input-inline layui-module-itemL">
		<div> {$level.name}(元) </div>
		<input type="text" name="teamfenhongjddata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongjddata2[$level['id']]['commission']}">
	</div>
	{/foreach}
</div>
</div>
{/if}
<!--团队见单分红end-->
</div>
{/if}
{if getcustom('product_commission_mid')}
<div class="layui-form-item">
	<label class="layui-form-label">指定{:t('会员')}佣金：</label>
	<div class="layui-input-block" style="width:800px">
		<table class="layui-table product_commission_mid" style="width:540px" id="product_commission_mid">
			<thead>
			<tr>
				<th>{:t('会员')}ID</th>
				<th>名称</th>
				<th>提成比例(%)</th>
				<th>提成金额</th>
				<th>操作</th>
			</tr>
			</thead>
			{if $info['commission_mid']}
			{foreach $info['commission_mid'] as $k=>$item}
			<tr class="choose-tr-list">
				<td><input type="text" name="commission_mid[{$item.ks}][mid]" value="{$item.mid}" class="layui-input" style="width:70px"/></td>
				<td><input type="text" name="commission_mid[{$item.ks}][name]" value="{$item.name}" class="layui-input" style="width:120px"/></td>
				<td><input type="text" name="commission_mid[{$item.ks}][percent]" value="{$item.percent}" class="layui-input" style="width:70px"/></td>
				<td><input type="text" name="commission_mid[{$item.ks}][money]" value="{$item.money}" class="layui-input" style="width:70px"/></td>
				<td><input type="hidden" name="commission_mid[{$item.ks}][ks]" value="{$item.ks}"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTrUp(this)">删除</button></td>
			</tr>
			{/foreach}
			{/if}
			<tr class="choose-tr-add">
				<td colspan="5" align="center"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addChooseTrUp()">添加</button></td>
			</tr>
		</table>
		<script>
			let ks_c = {:count($info['commission_mid'])};
			function addChooseTrUp(){
				var chooseClassName = '.product_commission_mid';
				var tr = '<tr class="choose-tr-list">' +
						'<td><input type="text" name="commission_mid['+ks_c+'][mid]" value="" class="layui-input" style="width:70px"/></td>'+
						'<td><input type="text" name="commission_mid['+ks_c+'][name]" value="" class="layui-input" style="width:120px"/></td>'+
						'<td><input type="text" name="commission_mid['+ks_c+'][percent]" value="" class="layui-input" style="width:70px"/></td>'+
						'<td><input type="text" name="commission_mid['+ks_c+'][money]" value="" class="layui-input" style="width:70px"/></td>'+
						'<td><input type="hidden" name="commission_mid['+ks_c+'][ks]" value="'+ks_c+'"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTrUp(this)">删除</button></td>' +
						'</tr>';
				ks_c +=1;
				$(chooseClassName).find('.choose-tr-add').before(tr);
			}
			function delChooseTrUp(obj){
				$(obj).closest('.choose-tr-list').remove();
			}
		</script>
	</div>
</div>
{/if}
<!--加权分红S-->
{if getcustom('fenhong_jiaquan_bylevel')}
<div class="layui-form-item">
	<label class="layui-form-label">加权分红：</label>
	<div class="layui-input-block" style="width:800px">
		<input type="radio" name="info[fenhong_jq_status]" value="0" {if !$info['id'] || $info['fenhong_jq_status']==0}checked{/if} title="不参与">
		<input type="radio" name="info[fenhong_jq_status]" value="1" {if $info['id'] && $info['fenhong_jq_status']==1}checked{/if} title="参与">
	</div>
</div>
{/if}
<!--加权分红E-->
{if $bid==0 || $business_selfscore == 1}
<div class="layui-form-item">
	<label class="layui-form-label">{:t('积分')}抵扣：</label>
	<div class="layui-input-block" style="width:800px">
		<input type="radio" name="info[scoredkmaxset]" value="0" {if !$info['id'] || $info['scoredkmaxset']==0}checked{/if} title="按照系统设置抵扣" lay-filter="scoredkmaxset">
		<input type="radio" name="info[scoredkmaxset]" value="1" {if $info['scoredkmaxset']==1}checked{/if} title="单独设置抵扣比例" lay-filter="scoredkmaxset">
		<input type="radio" name="info[scoredkmaxset]" value="2" {if $info['scoredkmaxset']==2}checked{/if} title="单独设置抵扣金额" lay-filter="scoredkmaxset">
		<input type="radio" name="info[scoredkmaxset]" value="-1" {if $info['scoredkmaxset']==-1}checked{/if} title="不可用{:t('积分')}抵扣" lay-filter="scoredkmaxset">
	</div>
</div>
<div id="scoredkmaxset1" {if $info['scoredkmaxset']!=1 && $info['scoredkmaxset']!=2}style="display:none"{/if}>
<div class="layui-form-item">
	<label class="layui-form-label"></label>
	<div class="layui-input-inline layui-module-itemL">
		<div>最多抵扣(<span id="scoredkmaxunit">{$info['scoredkmaxset']==1?'%':'元'}</span>) </div>
		<input type="text" name="info[scoredkmaxval]" value="{$info.scoredkmaxval}" class="layui-input">
	</div>
</div>
</div>
{if $info['bid']>0}
<div class="layui-form-item">
	<label class="layui-form-label">抽成费率：</label>
	<div class="layui-input-inline" style="width:200px">
		<input type="text" name="info[feepercent]" class="layui-input" value="{$info.feepercent}">
	</div>
	<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">%，平台收取的佣金比例，留空使用商户统一费率，如设置10%，平台抽佣10%，商家得90%；设置0则不抽成</div>
</div>
{/if}
{else}
<div class="layui-form-item">
	<label class="layui-form-label">抽成费率：</label>
	<div class="layui-input-inline" style="width:200px">
		<input type="text" name="" disabled readonly class="layui-input layui-disabled" value="{$info.feepercent}">
	</div>
	<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">%，平台收取的佣金比例，留空使用商户统一费率(商家不可修改)</div>
</div>
{/if}
{if getcustom('product_baodan')}
<div class="layui-form-item">
	<label class="layui-form-label">报单产品：</label>
	<div class="layui-input-block" style="width:800px">
		<input type="radio" name="info[product_baodan]" value="0" {if $info['id'] && $info['product_baodan']==0}checked{/if} title="否" >
		<input type="radio" name="info[product_baodan]" value="1" {if  $info['product_baodan']==1}checked{/if} title="是">
	</div>
</div>
{/if}
{if getcustom('yx_queue_free')}
<div class="layui-form-item">
	<label class="layui-form-label">排队免单：</label>
	<div class="layui-input-block" style="width:800px">
		<input type="radio" name="info[queue_free_status]" value="0" {if !$info['id'] || $info['queue_free_status']==0}checked{/if} title="不参与" >
		<input type="radio" name="info[queue_free_status]" value="1" {if  $info['queue_free_status']==1}checked{/if} title="参与">
	</div>
</div>
{/if}
<div class="layui-form-item">
	<label class="layui-form-label">销量：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[sales]" value="{$info['id']?$info['sales']:'0'}" class="layui-input">
		<input type="hidden" name="info[oldsales]" value="{$info['id']?$info['sales']:'0'}" class="layui-input">
	</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">起售数量：</label>
	<div class="layui-input-inline">
		<input type="number" name="info[limit_start]" value="{$info['id']?$info['limit_start']:'0'}" class="layui-input">
	</div>
	<div class="layui-form-mid layui-word-aux">多少件起卖，0表示不限购</div>
	<div class="layui-form-mid layui-word-aux jieti_discount">整批：单规格数量限制，混批:不同规格总数量限制</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">每人限购：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[perlimit]" value="{$info['id']?$info['perlimit']:'0'}" class="layui-input">
	</div>
	<div class="layui-form-mid layui-word-aux">每人最多可购买多少件，0表示不限购</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">每单限购：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[perlimitdan]" value="{$info['id']?$info['perlimitdan']:'0'}" class="layui-input">
	</div>
	<div class="layui-form-mid layui-word-aux">每单最多可购买多少件，0表示不限购</div>
</div>

{if getcustom('product_memberlevel_limit')}
	<!--会员等级限购 Start-->
	<div class="layui-form-item">
		<label class="layui-form-label">会员等级限购：</label>
		<div class="layui-input-inline" style="width:auto; ">
			<table class="layui-table choose-level" style="width:500px;" id="choose-level">
				<thead>
				<tr>
					<th>等级ID</th>
					<th>会员等级</th>
					<th>限购天数</th>
					<th>限购数量</th>
					<th>操作</th>
				</tr>
				</thead>
				{foreach $levellimitdata as $k=>$v}
				<tr class="choose-tr-list">
					<td>{$v.level_id}<input type="hidden" value='{$v.level_id}' name="level_id[]"></td>
					<td>{$v.name}</td>
					<td><input type="text" name="days[]" value="{$v.days}" class="layui-input" style="width:70px"/></td>
					<td><input type="text" name="limit_num[]" value="{$v.limit_num}" class="layui-input" style="width:70px"/></td>
					<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTr(this,{$ff.id})">删除</button></td>
				</tr>
				{/foreach}
			
				<tr class="choose-tr-add">
					<td colspan="5" align="center"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseLevel()">添加</button></td>
				</tr>
			</table>
		</div>
		<script>
			var chooseLevelLayer;
			function showChooseLevel(){
				chooseLevelLayer = layer.open({type:2,title:'选择{:t(\'等级\')}',content:"{:url('MemberLevel/chooselevel')}",area:['1000px','600px'],shadeClose:true});
			}
			function chooselevel(res){
				var detail = res;
				var chooseClassName = '.choose-level';
				layer.close(chooseLevelLayer);
				var objIds = [];
				var isadd = 0;
				$(chooseClassName).find('.choose-tr-list').each(function(){
					var thisfid = $(this).find('td:eq(0)').html();
					if(thisfid == detail.id){
						isadd = 1
						dialog('该项已添加过了');
					}
					objIds.push(thisfid)
				});
				if(isadd == 0){
					objIds.push(detail.id)

					var html='';
					html+='<tr class="choose-tr-list">';
					html+='<td>'+detail.id+'</td>';
					html+='<td>'+detail.name+'<input type="hidden" value='+detail.id+' name="level_id[]"></td>';
					html+='<td><input type="text" name="days[]" value="1" class="layui-input" style="width:70px"/></td>';
					html+='<td><input type="text" name="limit_num[]" value="1" class="layui-input" style="width:70px"/></td>';
					html+= '<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delChooseTr(this,'+detail.id+')">删除</button></td></tr>';

					$(chooseClassName).find('.choose-tr-add').before(html);
				}
				layui.form.render();
			}
			function delChooseTr(obj,fid){
				$(obj).closest('.choose-tr-list').remove();
				var objIds = [];
				$('#choose-level').find('.choose-tr-list').each(function(){
					objIds.push($(this).find('td:eq(0)').html())
				})
	
			}
		</script>
	</div>
	<!--会员等级限购 End-->
{/if}


{if getcustom('shop_yuding')}
<div class="layui-form-item">
	<label class="layui-form-label">预定库存：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[yuding_stock]" value="{$info['yuding_stock']?$info['yuding_stock']:'0'}" lay-verify="positiveWholeNumberRequiredTrue"  class="layui-input">
	</div>
	<div class="layui-form-mid layui-word-aux">普通库存为0，预定库存大于0时显示预定按钮</div>
</div>
{/if}
<div class="layui-form-item">
	<label class="layui-form-label">序号：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[sort]" value="{$info['sort']?$info['sort']:'0'}" class="layui-input">
	</div>
	<div class="layui-form-mid layui-word-aux">用于排序,越大越靠前</div>
</div>

{if getcustom('shop_product_recommend')}
<div class="layui-form-item">
	<label class="layui-form-label">商品推荐：</label>
	<div class="layui-input-inline" style="width:500px">
		<input type="radio" name="info[show_recommend]" value="0" {if !info['id'] || $info['show_recommend']==0}checked{/if} title="关闭" lay-filter="show_recommend"/>
		<input type="radio" name="info[show_recommend]" value="1" {if $info['show_recommend']==1}checked{/if} title="随机" lay-filter="show_recommend"/>
		<input type="radio" name="info[show_recommend]" value="2" {if $info['show_recommend']==2}checked{/if} title="自选" lay-filter="show_recommend"/>
	</div>
</div>
<div class="show_recommend2" style="clear:both;{if $info['show_recommend']!=2}display:none{/if}">
	<label class="layui-form-label"></label>
	<div class="layui-input-inline" style="width:auto">
		<table id="setproductdiv"  class="layui-table" style="width:500px">
			<thead>
			<tr>
				<th>商品ID</th>
				<th>商品名称</th>
				<th>操作</th>
			</tr>
			</thead>
			{php}
			$productdata = array();
			if($info && $info['recommend_productids']){
			$productdata = \think\facade\Db::name('shop_product')->where('aid',aid)->where('id','in',$info['recommend_productids'])->order(\think\facade\Db::raw('field(id,'.$info['recommend_productids'].')'))->select()->toArray();
			}
			{/php}
			{if $productdata}
			{foreach $productdata as $k=>$ff}
			<tr class="productlisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delProduct(this,{$ff.id})">删除</button></td></tr>
			{/foreach}
			{/if}
			<tr id="productaddtr">
				<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseProduct()">添加</button></td>
			</tr>
		</table>
		<input type="hidden" name="info[recommend_productids]" value="{$info.recommend_productids}"/>
	</div>
</div>
<script>
	var chooseProductLayer;
	function showChooseProduct(){
		chooseProductLayer = layer.open({type:2,title:'选择商品',content:"{:url('ShopProduct/chooseproduct')}/type/2/hidebid/1",area:['1000px','600px'],shadeClose:true});
	}
	function choosepro2(res){
		console.log(res)
		var product = res.product
		layer.close(chooseProductLayer);
		var recommend_productids = [];
		var isadd = 0;
		$('.productlisttr').each(function(){
			var thisfid = $(this).find('td:eq(0)').html();
			if(thisfid == product.id){
				isadd = 1
				dialog('该商品已添加过了');
			}
			recommend_productids.push(thisfid)
		})
		if(isadd == 0){
			recommend_productids.push(product.id)
			$("input[name='info[recommend_productids]']").val(recommend_productids.join(','));
			$('#productaddtr').before('<tr class="productlisttr"><td>'+product.id+'</td><td>'+product.name+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delProduct(this,'+product.id+')">删除</button></td></tr>');
		}
		console.log(recommend_productids)
	}
	function delProduct(obj,fid){
		$(obj).parent().parent().remove();
		var recommend_productids = [];
		$('.productlisttr').each(function(){
			recommend_productids.push($(this).find('td:eq(0)').html())
		})
		$("input[name='info[recommend_productids]']").val(recommend_productids.join(','));
	}
</script>
{/if}

{if getcustom('plug_tengrui')}
<div class="layui-form-item">
	<label class="layui-form-label">认证{:t('会员')}：</label>
	<div class="layui-input-inline">
		<input type="radio" name="info[is_rzh]" value="0" {if !$info['id'] || $info['is_rzh']==0}checked{/if} title="否"/>
		<input type="radio" name="info[is_rzh]" value="1" {if $info['id'] && $info['is_rzh']==1}checked{/if} title="是"/>
	</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">{:t('会员')}关系：</label>
	<div class="layui-input-inline" style="width:500px">
		<input type="radio" name="info[relation_type]" value="-1" {if !$info['id'] || $info['relation_type']==-1}checked{/if} title="所有"/>
		<input type="radio" name="info[relation_type]" value="0" {if $info['id'] && $info['relation_type']==0}checked{/if} title="业主"/>
		<input type="radio" name="info[relation_type]" value="1" {if $info['id'] && $info['relation_type']==1}checked{/if} title="家属"/>
		<input type="radio" name="info[relation_type]" value="2" {if $info['id'] && $info['relation_type']==2}checked{/if} title="租户"/>
		<input type="radio" name="info[relation_type]" value="3" {if $info['id'] && $info['relation_type']==3}checked{/if} title="买断"/>
		<input type="radio" name="info[relation_type]" value="4" {if $info['id'] && $info['relation_type']==4}checked{/if} title="租用"/>
	</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">一户仅限一次：</label>
	<div class="layui-input-inline">
		<input type="radio" name="info[house_status]" value="0" {if $info['id'] && $info['house_status']==0}checked{/if} title="否"/>
		<input type="radio" name="info[house_status]" value="1" {if !$info['id'] || $info['house_status']==1}checked{/if} title="是"/>
	</div>
	<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">需是认证用户，且同一个小区的同一户只限一人购买，即一户仅限一次</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">授权小区：</label>
	<div class="layui-input-inline" style="width:500px">
		<input type="radio" name="info[group_status]" value="0" {if $info['group_status']==0}checked{/if} title="关闭" lay-filter="group_status"/>
		<input type="radio" name="info[group_status]" value="1" {if $info['group_status']==1}checked{/if} title="开启" lay-filter="group_status"/>
	</div>
	<div class="group_status1 fwtypeExtend" style="clear:both;{if $info['group_status']!=1}display:none{/if}">
		<label class="layui-form-label"></label>
		<div class="layui-input-inline" style="width:auto">
			<table id="setgroupdiv"  class="layui-table" style="width:500px">
				<thead>
				<tr>
					<th>小区ID</th>
					<th>小区名称</th>
					<th>操作</th>
				</tr>
				</thead>
				{if $groupdata}
				{foreach $groupdata as $gk=>$gv}
				<tr class="grouplisttr"><td>{$gv.id}</td><td>{$gv.fullName}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,{$gv.id})">删除</button></td></tr>
				{/foreach}
				{/if}
				<tr id="groupaddtr">
					<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseGroup()">添加</button></td>
				</tr>
			</table>
			<input type="hidden" name="info[group_ids]" value="{$info.group_ids}"/>
		</div>
	</div>
	<script>
		var chooseGroupLayer;
		function showChooseGroup(){
			chooseGroupLayer = layer.open({type:2,title:'选择分组',content:"{:url('MemberTrGroup/choosegroup')}",area:['1000px','600px'],shadeClose:true});
		}
		function chooseGroup(fid,fname){
			layer.close(chooseGroupLayer);
			var group_ids = [];
			var isadd = 0;
			$('.grouplisttr').each(function(){
				var thisfid = $(this).find('td:eq(0)').html();
				if(thisfid == fid){
					isadd = 1
					dialog('该分组已添加过了');
				}
				group_ids.push(thisfid)
			})
			if(isadd == 0){
				group_ids.push(fid)
				$("input[name='info[group_ids]']").val(group_ids.join(','));
				$('#groupaddtr').before('<tr class="grouplisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,'+fid+')">删除</button></td></tr>');
			}
			console.log(group_ids)
		}
		function delGroup(obj,fid){
			$(obj).parent().parent().remove();
			var group_ids = [];
			$('.grouplisttr').each(function(){
				group_ids.push($(this).find('td:eq(0)').html())
			})
			$("input[name='info[group_ids]']").val(group_ids.join(','));
		}
	</script>
</div>
{/if}
{if $bid==0 || $bset['product_showset']==1}
<div class="layui-form-item">
	<label class="layui-form-label">显示条件：</label>
	<div class="layui-input-inline" style="width:800px">
		<input type="checkbox" name="info[showtj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['showtj'])}checked{/if}/>
		<input type="checkbox" name="info[showtj][]" value="-2" title="未登录用户" lay-skin="primary" {if !$info['id'] || in_array('-2',$info['showtj'])}checked{/if}/>
		<input type="checkbox" name="info[showtj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['showtj'])}checked{/if}/>
		{foreach $levellist as $v}
		<input type="checkbox" name="info[showtj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['showtj'])}checked{/if}/>
		{/foreach}
	</div>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">购买条件：</label>
	<div class="layui-input-inline" style="width:800px">
		<input type="checkbox" name="info[gettj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['gettj'])}checked{/if} lay-filter="gettjset"/>
		<input type="checkbox" name="info[gettj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['gettj'])}checked{/if}/>
		{foreach $levellist as $v}
		<input type="checkbox" name="info[gettj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['gettj'])}checked{/if}/>
		{/foreach}
	</div>
</div>
{/if}



<div id="gettjset" {if !$info['id'] || in_array('-1',$info['gettj'])}style="display:none"{/if}>
<div class="layui-form-item">
	<div class="layui-form-label">无权限提示：</div>
	<div class="layui-input-inline">
		<input class="layui-input" name="info[gettjtip]" value="{if !$info['id']}您没有权限购买该商品{else}{$info.gettjtip}{/if}"/>
	</div>
	<div class="layui-form-mid"></div>
</div>
<div class="layui-form-item">
	<div class="layui-form-label">无权限跳转：</div>
	<div class="layui-input-inline">
		<input class="layui-input" name="info[gettjurl]" value="{$info.gettjurl}" id="gettjurl"/>
	</div>
	<div class="layui-btn layui-btn-primary" style="float:left" onclick="chooseUrl2('gettjurl')">选择链接</div>
</div>
</div>
{if getcustom('buy_selectmember')}
<div class="layui-form-item">
	<div class="layui-form-label">尾款：</div>
	<div class="layui-input-inline">
		<input class="layui-input" name="info[balance]" value="{$info.balance}"/>
	</div>
	<div class="layui-form-mid">%</div>
</div>
{/if}

{if getcustom('product_payaftergive')}
<div class="layui-form-item">
	<label class="layui-form-label">支付后赠送：</label>
	<div class="layui-input-inline layui-module-itemL">
		<div>抽奖次数</div>
		<input type="text" name="info[paygive_choujiangtimes]" class="layui-input" value="{$info.paygive_choujiangtimes}">
	</div>
	<div class="layui-input-inline layui-module-itemL">
		<div>抽奖活动ID</div>
		<input type="text" name="info[paygive_choujiangid]" class="layui-input" value="{$info.paygive_choujiangid}">
	</div>
	<div class="layui-input-inline layui-module-itemL">
		<div>余额</div>
		<input type="text" name="info[paygive_money]" class="layui-input" value="{$info.paygive_money}">
	</div>
	<div class="layui-input-inline layui-module-itemL">
		<div>积分</div>
		<input type="text" name="info[paygive_score]" class="layui-input" value="{$info.paygive_score}">
	</div>
	<div class="layui-input-inline layui-module-itemL">
		<div>优惠券ID</div>
		<input type="text" name="info[paygive_couponid]" class="layui-input" value="{$info.paygive_couponid}">
	</div>
</div>
{/if}

{if getcustom('payaftertourl')}
<div class="layui-form-item">
	<div class="layui-form-label">支付后跳转：</div>
	<div class="layui-input-inline" style="width:500px">
		<input class="layui-input" name="info[payaftertourl]" id="payaftertourl" value="{$info.payaftertourl}"/>
	</div>
	<div class="layui-btn layui-btn-primary" style="float:left" onclick="chooseUrl2('payaftertourl')">选择链接</div>
</div>
<div class="layui-form-item">
	<div class="layui-form-label">跳转按钮文本：</div>
	<div class="layui-input-inline">
		<input class="layui-input" name="info[payafterbtntext]" value="{$info.payafterbtntext}"/>
	</div>
</div>
{/if}
{if getcustom('everyday_hongbao') && $ehb_status}
<div class="layui-form-item">
	<div class="layui-form-label">红包额度比例：</div>
	<div class="layui-input-inline" style="width: 400px;">
		<input class="layui-input" name="info[everyday_hongbao_bl]" value="{$info.everyday_hongbao_bl}"/>
		<div class="layui-form-mid layui-word-aux">购买商品给{:t('会员')}的红包额度，留空使用系统设置比例，0则不参与红包活动</div>
	</div>

	<div class="layui-form-mid layui-word-aux">%</div>
</div>
{/if}

<div class="layui-form-item" {if !getcustom('level_comwithdraw')}style="display:none"{/if}>
<label class="layui-form-label">会员折扣：</label>
<div class="layui-input-inline" style="width:600px">
	<input type="radio" name="info[no_discount]" value="0" title="参与" {if !$info['id'] || $info['no_discount']==0}checked{/if}/>
	<input type="radio" name="info[no_discount]" value="1" title="不参与" {if $info['id'] && $info['no_discount']==1}checked{/if}/>
</div>
</div>

{if getcustom('product_moneypay')}
<div class="layui-form-item">
	<label class="layui-form-label">余额支付：</label>
	<div class="layui-input-inline" style="width:600px">
		<input type="radio" name="info[product_moneypay]" value="1" title="支持" {if !$info['id'] || $info['product_moneypay']==1}checked{/if}/>
		<input type="radio" name="info[product_moneypay]" value="0" title="不支持" {if $info['id'] && $info['product_moneypay']==0}checked{/if}/>
		<input type="radio" name="info[product_moneypay]" value="2" title="仅限余额" {if $info['id'] && $info['product_moneypay']==2}checked{/if}/>
	</div>
</div>
{/if}
{if getcustom('commission_xiaofei')}
<div class="layui-form-item">
	<label class="layui-form-label">{:t('冻结佣金')}支付：</label>
	<div class="layui-input-inline" style="width:600px">
		<input type="radio" name="info[product_xiaofeipay]" value="1" title="支持" {if !$info['id'] || $info['product_xiaofeipay']==1}checked{/if}/>
		<input type="radio" name="info[product_xiaofeipay]" value="0" title="不支持" {if $info['id'] && $info['product_xiaofeipay']==0}checked{/if}/>
	</div>
</div>
{/if}

{if getcustom('buybutton_custom')}
{if $buybtn_status == 1}
<div class="layui-form-item">
	<label class="layui-form-label">购买按钮：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[buybtn_name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.buybtn_name?$info.buybtn_name:'立即购买'}">
	</div>
	<div class="layui-input-inline" style="width: 300px">
		<input type="hidden" id="buybtn_link_name" name="info[buybtn_link_name]" value="{$info.buybtn_link_name}">
		<span class="layui-btn  layui-btn-primary" style="float: left;" onclick="chooseUrlWindow()">选择链接</span>
		<input type="text" id="buybtn_link_url" name="info[buybtn_link_url]" value="{$info.buybtn_link_url}"  class="layui-input" style="display: inline-block;width: 200px;margin-left: 5px;">
	</div>
	<div class="buybtn_link_name" style="line-height: 38px">{$info.buybtn_link_name}</div>
</div>
{/if}
{/if}

{if getcustom('addcart_button_custom') && $addcart_button_custom_status}
<div class="layui-form-item">
	<label class="layui-form-label">加入购物车按钮：</label>
	<div class="layui-input-inline">
		<input type="text" name="info[addcart_name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.addcart_name?$info.addcart_name:'加入购物车'}">
	</div>
	<div class="layui-input-inline" style="width: 300px">
		<input type="hidden" id="addcart_link_name" name="info[addcart_link_name]" value="{$info.addcart_link_name}">
		<span class="layui-btn  layui-btn-primary" style="float: left;" onclick="chooseUrlWindow2()">选择链接</span>
		<input type="text" id="addcart_link_url" name="info[addcart_link_url]" value="{$info.addcart_link_url}"  class="layui-input" style="display: inline-block;width: 200px;margin-left: 5px;">
	</div>
	<div class="addcart_link_name" style="line-height: 38px">{$info.addcart_link_name}</div>
</div>
{/if}
{if getcustom('product_bonus_pool') }
{if $product_bonus_pool_status }
	<div class="layui-form-item">
		<label class="layui-form-label">奖金池比例：</label>
		<div class="layui-input-inline">
			<input type="text" name="info[bonus_pool_ratio]" value="{$info['bonus_pool_ratio']}"  class="layui-input">
		</div>
		<div class="layui-form-mid">%</div>
		<div class="layui-form-mid layui-word-aux">奖金池金额 = 付款金额 * 奖金池比例，不填为不开启</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">奖金池份数：</label>
		<div class="layui-input-inline">
			<input type="text" name="info[bonus_pool_num]" value="{$info['bonus_pool_num']}"   class="layui-input">
		</div>
		<div class="layui-form-mid">份</div>
		<div class="layui-form-mid layui-word-aux">贡献值金额 = 付款价格*奖金池比例 /奖金池份数  </div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">是否进行释放：</label>
		<div class="layui-input-inline" >
			<input type="radio" name="info[bonus_pool_isrelease]" value="1" title="释放" {if  $info['bonus_pool_isrelease']==1}checked{/if} lay-filter=""/>
			<input type="radio" name="info[bonus_pool_isrelease]" value="0" title="不释放" {if $info['id'] && $info['bonus_pool_isrelease']==0}checked{/if} lay-filter=""/>
		</div>
		<div class="layui-form-mid layui-word-aux">【释放】产生奖金可释放；【不释放】产生奖金不释放，释放给其他有资格会员</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">释放条件：</label>
		<div class="layui-input-inline" style="width:800px">
			<input type="checkbox" name="info[bonus_pool_releasetj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['bonus_pool_releasetj'])}checked{/if} />
			{foreach $levellist as $v}
			<input type="checkbox" name="info[bonus_pool_releasetj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['bonus_pool_releasetj'])}checked{/if}/>
			{/foreach}
		</div>
		<div class="layui-form-mid layui-word-aux">开启释放后才能生效</div>
	</div>
{/if}
{/if}

{if getcustom('mendian_hexiao_givemoney')}
<div class="layui-form-item">
	<label class="layui-form-label">门店核销提成：</label>
	<div class="layui-input-inline layui-module-itemL">
		<div>提成比例(%)</div>
		<input style="width: 120px;" type="text" id="hexiaogivepercent" name="info[hexiaogivepercent]" class="layui-input" value="{$info.hexiaogivepercent|default=''}">
	</div>
	<div class="layui-input-inline layui-module-itemL">
		<div>提成金额(元)</div>
		<input style="width: 120px;" type="text" id="hexiaogivemoney" name="info[hexiaogivemoney]" class="layui-input" value="{$info.hexiaogivemoney|default=''}">
	</div>
	<div class="layui-form-mid layui-word-aux">此商品提成=（商品金额*提成比例+提成金额）*购买数量。注意：商品独立设置优先级高于门店设置，留空使用门店设置</div>
</div>
{/if}
{if getcustom('reward_business_score')}
<div class="layui-form-item">
	<label class="layui-form-label">店长奖励{:t('积分')}：</label>
	<div class="layui-input-inline layui-module-itemL">
		<div>{:t('积分')}数量</div>
		<input style="width: 120px;" type="text" name="info[reward_business_score]" class="layui-input" value="{$info.reward_business_score|default=''}" {if $bid>0}readonly style="background:#e6e6e6;"{/if}>
	</div>
	<div class="layui-form-mid layui-word-aux">奖励到商家对应绑定的会员账号，店长奖励{:t('积分')}=店长奖励{:t('积分')}*数量，订单确认收货发放</div>
</div>
{/if}


<div class="layui-form-item">
	<label class="layui-form-label">状态：</label>
	<div class="layui-input-inline" style="width:600px">
		<input type="radio" name="info[status]" value="1" title="已上架" {if !$info['id'] || $info['status']==1}checked{/if} lay-filter="set_status"/>
		<input type="radio" name="info[status]" value="0" title="未上架" {if $info['id'] && $info['status']==0}checked{/if} lay-filter="set_status"/>
		<input type="radio" name="info[status]" value="2" title="设置上架时间" {if $info['id'] && $info['status']==2}checked{/if} lay-filter="set_status"/>
		<input type="radio" name="info[status]" value="3" title="设置上架周期" {if $info['id'] && $info['status']==3}checked{/if} lay-filter="set_status"/>
	</div>
</div>

<div class="layui-form-item" id="set_status2" {if $info['status']!=2}style="display:none"{/if}>
<label class="layui-form-label">上架时间：</label>
<div class="layui-input-inline" style="width:150px">
	<input type="text" name="info[start_time]" class="layui-input" value="{$info.start_time}" id="start_time" autocomplete="off">
</div>
<div class="layui-form-mid">到</div>
<div class="layui-input-inline" style="width:150px">
	<input type="text" name="info[end_time]" class="layui-input" value="{$info.end_time}" id="end_time" autocomplete="off">
</div>
<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:110px"></div>
</div>
<div class="layui-form-item" id="set_status3" {if $info['status']!=3}style="display:none"{/if}>
<label class="layui-form-label">上架周期：</label>
<div class="layui-input-inline" style="width:150px">
	<input type="text" name="info[start_hours]" class="layui-input" value="{$info.start_hours}" id="start_hours" autocomplete="off">
</div>
<div class="layui-form-mid">到</div>
<div class="layui-input-inline" style="width:150px">
	<input type="text" name="info[end_hours]" class="layui-input" value="{$info.end_hours}" id="end_hours" autocomplete="off">
</div>
<div class="layui-form-mid layui-word-aux layui-clear">结束时间小于或等于开始时间表示跨天,如:16:00到06:00表示下午4点到次日早晨6点</div>
</div>

{if $fromwxvideo}
<div class="layui-form-item">
	<label class="layui-form-label">类目ID：</label>
	<div class="layui-input-inline" style="width:200px">
		<input type="text" name="info[wxvideo_third_cat_id]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info['wxvideo_third_cat_id']}">
	</div>
	<button type="button" class="layui-btn layui-btn-primary" onclick="showChooseCategory()">选择</button>
</div>
<div class="layui-form-item">
	<label class="layui-form-label">品牌：</label>
	<div class="layui-input-inline" style="width:200px">
		<select name="info[wxvideo_brand_id]">
			{foreach $brand_list as $v}
			<option value="{$v.brand_id}" {if $info['wxvideo_brand_id'] == $v['brand_id']}selected{/if}>{$v.brand_wording}</option>
			{/foreach}
		</select>
	</div>
</div>

<div class="layui-form-item" id="trademark_registration_certificate_div">
	<label class="layui-form-label">资质图片：</label>
	<input type="hidden" name="info[wxvideo_qualification_pics]" value="{$info['wxvideo_qualification_pics']}" id="wxvideo_qualification_pics">
	<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="wxvideo_qualification_pics" upload-preview="qualification_picsList" >上传图片</button>
	<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">如所选类目需要商品资质，请在此上传</div>
	<div id="qualification_picsList" style="float:left;padding-top:10px;padding-left:110px;clear: both;">
		{if $info['wxvideo_qualification_pics']}{php}$pics = explode(',',$info['wxvideo_qualification_pics']);{/php}{foreach $pics as $pic}
		<div class="layui-imgbox">
			<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('wxvideo_qualification_pics','qualification_picsList')" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
			<span class="layui-imgbox-img"><img src="{$pic}"></span>
		</div>
		{/foreach}{/if}
	</div>
</div>
{/if}


<div class="layui-form-item">
	<label class="layui-form-label"></label>
	<div class="layui-input-block">
		<button class="layui-btn layui-btn-normal" onclick="gonext(2)">下一步:编辑商品参数</button>
		<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
	</div>
</div>

</div>

<div class="layui-tab-item">
	<div class="paramTab">
		{if !$paramList}<div class="layui-form-item"><label class="layui-form-label"></label><div class="layui-form-mid">暂未添加商品参数或当前商品分类下无参数，<a href="javascript:void(0)" onclick="openmax('{:url('ShopParam/index')}&isopen=1')">去添加</a></div></div>{/if}
		{foreach $paramList as $k=>$param}
		<div class="layui-form-item">
			<label class="layui-form-label">{if $param['is_required']==1}<span class="redstar">*</span>{/if}{$param.name}：</label>
			{if $param.type == '0'}
			<div class="layui-input-inline" style="width:240px">
				<input type="text" class="layui-input" name="paramdata[{$param.name}]" value="{$paramdata[$param['name']]}" {if $param['is_required']==1}lay-verify="required" lay-verType="tips"{/if} placeholder="{$param.tips}"/>
			</div>
			{elseif $param.type == '1'}
			<div class="layui-input-inline" style="width:240px">
				<select name="paramdata[{$param.name}]" {if $param['is_required']==1}lay-verify="required" lay-verType="tips"{/if}>
				<option value="">{$param.tips}</option>
				{php} $params = json_decode($param['params'],true);{/php}
				{foreach $params as $pm}<option {if $paramdata[$param['name']] == $pm}selected{/if}>{$pm}</option>{/foreach}
				</select>
			</div>
			{elseif $param.type == '2'}
			<div class="layui-input-inline" style="width:500px">
				{php} $params = json_decode($param['params'],true);{/php}
				{foreach $params as $pm}
				<input type="checkbox" name="paramdata[{$param.name}][]" value="{$pm}" title="{$pm}" lay-skin="primary" {if in_array($pm,$paramdata[$param['name']])}checked{/if}>
				{/foreach}
			</div>
			<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:130px">{$param.tips}</div>
			{/if}
		</div>
		{/foreach}
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label"></label>
		<div class="layui-input-block">
			<button class="layui-btn layui-btn-normal" onclick="gonext(3)">下一步:编辑商品详情</button>
			<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label"></label>
		<div class="layui-input-inline" style="width:500px"></div>
		<div class="layui-form-mid layui-word-aux">使用商品对应的分类参数+未关联分类参数</div>
	</div>
</div>

<div class="layui-tab-item">
	<!-- 详情编辑器 -->
	<!-- <div class="layui-form-item">
        <label class="layui-form-label">商品详情</label>
        <div class="layui-input-inline" style="width:500px">
            <script id="content" name="info[detail]" type="text/plain" style="width:100%;height:500px">{$info['detail']}</script>
        </div>
    </div> -->
	<!-- 详情编辑器 -->
	<?php
									$pagetitle='商品详情';
									$pagedata= $info['detail'] && json_decode($info['detail']) ? $info['detail'] : '[{"id":"M0000000000000","temp":"richtext","params":{bgcolor:"#FFFFFF",margin_x:"0",margin_y:"0",padding_x:"10",padding_y:"10","quanxian":{"all":true},"platform":{"all":true}},"data":"","other":"","content":""}]';
									?>
	{include file="designer_page/designer_editor" /}

	<div class="layui-form-item">
		<label class="layui-form-label"></label>
		<div class="layui-input-block">
			<button class="layui-btn layui-btn-normal" onclick="gonext(2)">上一步:编辑商品参数</button>
			<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
		</div>
	</div>
</div>
<div class="layui-tab-item">
	<div class="layui-form-item">
		<label class="layui-form-label">分享标题：</label>
		<div class="layui-input-inline" style="width:300px">
			<input type="text" class="layui-input" name="info[sharetitle]" value="{$info.sharetitle}"/>
		</div>
		<div class="layui-form-mid layui-word-aux">默认为商品名称</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">分享图标：</label>
		<input type="hidden" name="info[sharepic]" id="sharepic" lay-verType="tips" class="layui-input" value="{$info.sharepic}">
		<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="sharepic" upload-preview="sharepicPreview" onclick="uploader(this)">上传图片</button>
		<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：400*400像素，默认为商品主图</div>
		<div id="sharepicPreview" class="picsList-class-padding">
			<div class="layui-imgbox" style="width:100px;"><div class="layui-imgbox-img"><img src="{$info.sharepic}"/></div></div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">分享描述：</label>
		<div class="layui-input-inline" style="width:300px">
			<input type="text" class="layui-input" name="info[sharedesc]" value="{$info.sharedesc}"/>
		</div>
		<div class="layui-form-mid layui-word-aux">默认为商品卖点</div>
	</div>
	<!-- <div class="layui-form-item">
        <label class="layui-form-label">分享链接：</label>
        <div class="layui-input-inline" style="width:300px">
            <input type="text" class="layui-input" name="info[sharelink]" value="{$info.sharelink}"/>
        </div>
        <div class="layui-form-mid layui-word-aux">默认为商品链接，非特殊需求无需填写</div>
    </div> -->
	<div class="layui-form-item">
		<label class="layui-form-label"></label>
		<div class="layui-input-block">
			<button class="layui-btn layui-btn-normal" onclick="gonext(3)">上一步:编辑商品详情</button>
			<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
		</div>
	</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<video id="myvideo" style="display:none"></video>

<script>
	var fillstate =false;
	layui.form.verify({
		positiveWholeNumberRequiredTrue:[/^[+]{0,1}(\d+)$/,'只能填写正整数'],//必填，且只能输入
	})
	var formSelects = layui.formSelects;
	layui.form.on('radio(group_status)',function(data){
		if(data.value == 1){
			$('.group_status1').show();
		}else{
			$('.group_status1').hide();
		}

	})
	$(".layui-form input#video").bind("input change propertychange",function(event){
		var videourl = $('#video').val();
		if(videourl){
			$("#myvideo").prop("src", videourl);
			$("#myvideo")[0].addEventListener("loadedmetadata", function() {
				var tol = Math.floor(this.duration); //获取总时长
				$('#video_duration').val(tol);
			});
		}else{
			$('#video_duration').val(0);
		}
	})
	//var ueditor = UE.getEditor('content');
	layui.form.on('radio(freighttypeset)', function(data){
		if(data.value == '1'){
			$('#setfreight').hide();
			$('#freighttype3').hide();
			$('#freighttype4').hide();
		}else if(data.value == '3'){
			$('#setfreight').hide();
			$('#freighttype3').show();
			$('#freighttype4').hide();
		}else if(data.value == '4'){
			$('#setfreight').hide();
			$('#freighttype3').hide();
			$('#freighttype4').show();
		}else{
			$('#setfreight').show();
			$('#freighttype3').hide();
			$('#freighttype4').hide();
		}
	})


	layui.form.on('radio(weighttype)', function(data){
		if(data.value == '2'){
			$('#setweight').show();
		}else{
			$('#setweight').hide();
		}
	})

	layui.form.on('radio(set_status)',function(data){
		if(data.value=="0" || data.value=="1"){
			$('#set_status2').hide();
			$('#set_status3').hide();
		}
		if(data.value=="2"){
			$('#set_status2').show();
			$('#set_status3').hide();
		}
		if(data.value=="3"){
			$('#set_status2').hide();
			$('#set_status3').show();
		}
	});

	layui.laydate.render({
		elem: '#start_hours',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({
		elem: '#end_hours',
		type: 'time',
		format:'HH:mm',
		trigger: 'click'
	});
	layui.laydate.render({
		elem: '#start_time',
		type: 'datetime',
		trigger: 'click'
	});
	layui.laydate.render({
		elem: '#end_time',
		type: 'datetime',
		trigger: 'click'
	});

	layui.form.on('switch(isfuwu)',function(data){
		if(data.elem.checked){
			$('#isfuwudiv').show();
		}else{
			$('#isfuwudiv').hide();
		}
	})
	layui.form.on('radio(commissionset)', function(data){
		if(data.value == '1'){
			$('#commissionset1').show();
			$('#commissionset2').hide();
			$('#commissionset3').hide();
			$('#commissionset4').hide();
			{if getcustom('commission_butie')}
			$('#commission_butie').hide();
			$('#commission_butie2').show();
			{/if}
		}else if(data.value == '2'){
			$('#commissionset1').hide();
			$('#commissionset2').show();
			$('#commissionset3').hide();
			$('#commissionset4').hide();
			{if getcustom('commission_butie')}
			$('#commission_butie').show();
			$('#commission_butie2').hide();
			{/if}
		}else if(data.value == '3'){
			$('#commissionset1').hide();
			$('#commissionset2').hide();
			$('#commissionset3').show();
			$('#commissionset4').hide();
			{if getcustom('commission_butie')}
			$('#commission_butie').hide();
			$('#commission_butie2').hide();
			{/if}
		}else if(data.value == '5'){
			$('#commissionset1').show();
			$('#commissionset2').hide();
			$('#commissionset3').show();
			$('#commissionset4').hide();
			{if getcustom('commission_butie')}
			$('#commission_butie').hide();
			$('#commission_butie2').show();
			{/if}
		}else if(data.value == '6'){
			$('#commissionset1').hide();
			$('#commissionset2').show();
			$('#commissionset3').show();
			$('#commissionset4').hide();
			{if getcustom('commission_butie')}
			$('#commission_butie').show();
			$('#commission_butie2').hide();
			{/if}
		}else if(data.value == '7'){
			$('#commissionset1').hide();
			$('#commissionset2').hide();
			$('#commissionset3').hide();
			$('#commissionset4').show();
			{if getcustom('commission_butie')}
			$('#commission_butie').hide();
			$('#commission_butie2').hide();
			{/if}
		}else{
			$('#commissionset1').hide();
			$('#commissionset2').hide();
			$('#commissionset3').hide();
			$('#commissionset4').hide();
			{if getcustom('commission_butie')}
			$('#commission_butie').hide();
			$('#commission_butie2').hide();
			{/if}
		}
	});
	layui.form.on('radio(commissionpingjiset)', function(data){
		if(data.value == '1'){
			$('#commissionpingjiset1').show();
			$('#commissionpingjiset2').hide();
		}else if(data.value == '2'){
			$('#commissionpingjiset1').hide();
			$('#commissionpingjiset2').show();
		}else{
			$('#commissionpingjiset1').hide();
			$('#commissionpingjiset2').hide();
		}
	})
	//购车基金
	layui.form.on('radio(gouchebonusset)', function(data){
		if(data.value == '1'){
			$('#gouchebonusset1').show();
			$('#gouchebonusset2').hide();
		}else if(data.value == '2'){
			$('#gouchebonusset1').hide();
			$('#gouchebonusset2').show();
		}else{
			$('#gouchebonusset1').hide();
			$('#gouchebonusset2').hide();
		}
	})
	//旅游基金
	layui.form.on('radio(lvyoubonusset)', function(data){
		if(data.value == '1'){
			$('#lvyoubonusset1').show();
			$('#lvyoubonusset2').hide();
		}else if(data.value == '2'){
			$('#lvyoubonusset1').hide();
			$('#lvyoubonusset2').show();
		}else{
			$('#lvyoubonusset1').hide();
			$('#lvyoubonusset2').hide();
		}
	})
	layui.form.on('radio(fenhongset)', function(data){
		if(data.value == '1'){
			$('#fenhongset').show();
		}else{
			$('#fenhongset').hide();
		}
	})

	layui.form.on('radio(scoredkmaxset)', function(data){
		if(data.value == '1'){
			$('#scoredkmaxset1').show();
			$('#scoredkmaxunit').html('%');
		}else if(data.value == '2'){
			$('#scoredkmaxset1').show();
			$('#scoredkmaxunit').html('元');
		}else{
			$('#scoredkmaxset1').hide();
		}
	})
	function gonext(layid){
		$(window).scrollTop(0);
		layui.element.tabChange('mytab', layid);
	}
	layui.element.on('tab(mytab)', function(){
		try{
			changeconentxy();
		}catch(e){}
	})
	//var ueditor = UE.getEditor('editor');
	var oldgglist = {:json_encode($newgglist)};
	var Copyoldgglist = {:json_encode($newgglist)};
	$(function(){
		refreshgg();
	})
	function addggtype(){
		var gghtml = '<tr>';
		gghtml += '<td><input type="text" name="ggname" class="layui-input" value="" style="width:120px;margin-bottom: 5px;" placeholder="请输入规格分组"/></td>';
		gghtml += '<td><div><input type="text" name="ggnameguige" class="layui-input" style="width:180px;margin-bottom:5px" value="" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button></div></td>';
		gghtml += '<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>';
		gghtml += '</tr>';
		$('#ggnamediv').append(gghtml);
	}
	function addggname(obj){
		var pichtml = '';	
		{if getcustom('product_wholesale')}
		var tdindex = $(obj).parent().parent().parent().index();
		if(tdindex == 0){
			var randomNum = Math.floor(Math.random() * 100);
			var lt = $(obj).parent().siblings().length;
			var product_type = $(".product_type").val();
			if(product_type !=4){ 
				var style = 'style="display:none"';
			}
			pichtml='<div id="ggpic_wholesale'+randomNum+lt+'" class="jieti_discount" '+ style+'  ><input type="hidden" name="ggpic_wholesale" id="ggpic_wholesale_val'+randomNum+lt+'" value=""/><div class="guigeimg" style="margin-bottom:6px;" ><img class="thumb_img" src="" style="max-width:50px;"/><a  style="display: none;" class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).prev(\'.thumb_img\').attr(\'src\',\'\');$(this).parent().prev(\'input\').val(\'\');$(this).hide();"  title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a></div> <button class="layui-btn layui-btn-sm layui-btn-primary" style="margin-bottom:6px;"  onclick="uploader(this)" upload-input="ggpic_wholesale_val'+randomNum+lt+'" upload-preview="ggpic_wholesale'+randomNum+lt+'" type="button">上传</button></div>';
		}
		{/if}	
		var ggnameobj = $(obj).parent().parent().append('<div><input class="layui-input" name="ggnameguige" type="text" style="width:180px;margin-bottom:5px" value="" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delggname(this,1)" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button>'+pichtml+'</div>');
	}
	function delggname(obj,type){
		let ksarrdel = [];
		let haskongdel = 0;
		$('#ggnamediv').find("input").each(function(){
			if($(this).val()=='') haskongdel = 1
		})
		if(haskongdel){
			$(obj).parent().remove();return;
		}
		var product_type = $(".product_type").val();
		// 获取点击规格名称的索引
		var mcid= $(obj).parent().index();
		var fzid = $(obj).parent().parent().parent().index();
		$(obj).parent().remove();
		specs = [];
		var i=0;
		// 规格分组
		$('input[name=ggname]').each(function(){
			var ggval = [];
			var j=0;
			$(this).parent().next().find('input[name=ggnameguige]').each(function(){
				
				if(product_type ==4){
					var ggpic_wholesale = $(this).nextAll().find('input[name=ggpic_wholesale]').val();
					ggval.push({ 'k':j,'title':$(this).val(),'ggpic_wholesale':ggpic_wholesale});
				}else{
					ggval.push({ 'k':j,'title':$(this).val()});
				}
				//ggval.push({ 'k':j,'title':$(this).val()});
				j++
			})
			specs.push({ 'k':i,'title':$(this).val(),'items':ggval});
			i++;
		});
		var len = specs.length;
		var newlen = 1;
		var h = new Array(len);
		var rowspans = new Array(len);
		for(var i=0;i<len;i++){
			var itemlen = specs[i].items.length;
			if(itemlen<=0) { itemlen = 1 };
			newlen*=itemlen;
			h[i] = new Array(newlen);
			for(var j=0;j<newlen;j++){
				h[i][j] = new Array();
			}
			var l = specs[i].items.length;
			rowspans[i] = 1;
			for(j=i+1;j<len;j++){
				rowspans[i]*= specs[j].items.length;
			}
		}	
		for(var m=0;m<len;m++){
			var k = 0,kid = 0,n=0;
			for(var j=0;j<newlen;j++){
				var rowspan = rowspans[m];
				if( j % rowspan==0){
					h[m][j]={ k:specs[m].items[kid].k,title: specs[m].items[kid].title,id: specs[m].items[kid].id};
				}else{
					h[m][j]={ k:specs[m].items[kid].k,title:specs[m].items[kid].title,id: specs[m].items[kid].id};
				}
				n++;
				if(n==rowspan){
					kid++; if(kid>specs[m].items.length-1) { kid=0; }
					n=0;
				}
			}
		}
		for(var i=0;i<newlen;i++){
			var ks = [];
			for(var j=0;j<len;j++){
				ks.push( h[j][i].k);
			}
			ks =ks.join(',');
			ksarrdel.push(ks)
		}
	if(type){
		let oldgglistcopys = {}
		Object.keys(oldgglist).forEach(item => {
			if(item.split(',')[fzid] == mcid){
				delete oldgglist[item]
			}
		})
		ksarrdel.forEach((item,index) => {
			oldgglistcopys[item] = Object.values(oldgglist)[index]
		})
		oldgglist = oldgglistcopys
		return;
	}
		let oldgglistcopy = {}
		Object.keys(Copyoldgglist).forEach(item => {
			if(item.split(',')[$(obj).attr('data-id')] == $(obj).attr('id')){
				delete Copyoldgglist[item]
			}
		})
		if(Object.values(Copyoldgglist).length < ksarrdel.length){
			// 编辑时添加新规格删除
			let idarr = Object.values(Copyoldgglist).map(item => item.id);
			let arr = [];
			Object.values(oldgglist).forEach((item,index) => {
				// 通过数据唯一值id筛选未删除的数据
				if(item.id != undefined){
					if(idarr.some(i => i == item.id)){
						arr.push(item)
					}
				}else{
					// 判断当前数据的值是否为选中取消的
					if(Object.keys(oldgglist)[index].split(',')[fzid] != mcid){
						arr.push(item)
					}
				}
			})
			ksarrdel.forEach((item,index) => {
				oldgglistcopy[item] = arr[index];
			})
			// key值重新编译，数据按照顺序赋值
		}else{
			ksarrdel.forEach((item,index) => {
				oldgglistcopy[item] = Object.values(Copyoldgglist)[index]
			})
		}
		// 
		oldgglist = oldgglistcopy
	}
	function lvpriceset(){
		var lvprice = $("input[name='info[lvprice]']").val();
		if(lvprice == 0){
			$("input[name='info[lvprice]']").val('1');
			$('#lvpricebtn').text('关闭会员价');
			$('#commissionset4input').show();
			$('#commissionset4tips').show();
			$('#lvpricesetWithRate').show();
			//layui.form.render();
		}else{
			fillstate = false;
			$("input[name='info[lvprice]']").val('0');
			$('#lvpricebtn').text('开启会员价');
			$('#commissionset4input').hide();
			$('#commissionset4tips').hide();
			$('#lvpricesetWithRate').hide();
		}
		refreshgg()
	}
	function lvpricesetWithRate()
	{
		fillstate = true;
		refreshgg()
		//todo 等级列表$levellist，费率字段price_rate
	}
	var specs = [];
	function refreshgg(){
		var haskong = 0
		var ksarr = [];
		$('#ggnamediv').find("input[name=ggname]").each(function(){
			if($(this).val()=='') haskong = 1
		})
		if(haskong){
			layer.msg('请填写完整');return;
		}
		var lvprice = $("input[name='info[lvprice]']").val();
		var product_type = $(".product_type").val();
		
		specs = [];
		var i=0;
		// 规格分组
		$('input[name=ggname]').each(function(){
			var ggval = [];
			var j=0;
			$(this).parent().next().find('input[name=ggnameguige]').each(function(){
				
				if(product_type ==4){
					var ggpic_wholesale = $(this).nextAll().find('input[name=ggpic_wholesale]').val();
					ggval.push({ 'k':j,'title':$(this).val(),'ggpic_wholesale':ggpic_wholesale});
				}else{
					ggval.push({ 'k':j,'title':$(this).val()});
				}
				//ggval.push({ 'k':j,'title':$(this).val()});
				j++
			})

			specs.push({ 'k':i,'title':$(this).val(),'items':ggval});

			
			i++;
		});		
		console.log(specs)
		var len = specs.length;
		var newlen = 1;
		var h = new Array(len);
		var rowspans = new Array(len);
		var html = '<thead><tr>';
		for(var i=0;i<len;i++){
			html+="<th>" + specs[i].title + "</th>";
			var itemlen = specs[i].items.length;
			if(itemlen<=0) { itemlen = 1 };
			newlen*=itemlen;
			h[i] = new Array(newlen);
			for(var j=0;j<newlen;j++){
				h[i][j] = new Array();
			}
			var l = specs[i].items.length;
			rowspans[i] = 1;
			for(j=i+1;j<len;j++){
				rowspans[i]*= specs[j].items.length;
			}
		}
		var product_type = $(".product_type").val();
		{if getcustom('product_handwork')}
			var product_type = $(".product_type").val();
		{/if}
		html += '<th>规格编号</th>';
		html += '<th>市场价（元）</th>';
		html += '<th>成本价（元）</th>';
		if(lvprice==1){
			{foreach $levellist as $level}
			html += '<th>{$level.name}（元）</th>';
			{/foreach}
			}else{
				html += '<th>销售价（元）</th>';
			}
			{if getcustom('price_dollar') && usdrate>0}
			html += '<th>美元</th>';
			{/if}
				html += '<th>重量（克）</th>';
				html += '<th>库存</th>';
				{if $bid==0 || $business_selfscore==1}
				html += '<th>赠{:t('积分')}(个)</th>';
				{/if}
					{if getcustom('product_givetongzheng')}
					html += '<th>赠{:t('通证')}(个)</th>';
					{/if}
				{if getcustom('product_handwork')}
					if(product_type == 3){
						html += '<th class="handfee">手工费</th>';
					}else{
						html += '<th class="handfee" style="display:none">手工费</th>';
					}
				{/if}

					{if getcustom('guige_limit_start')}
					html += '<th>起售数量</th>';
					{/if}
					{if getcustom('product_stock_warning')}
					html += '<th>预警值</th>';
					{/if}
					if(product_type == 4){
						html += '<th class="showguigeimg" style="display:none">图片</th>';
					}else{
						html += '<th class="showguigeimg" >图片</th>';
					}
						html += '</tr></thead>';

						for(var m=0;m<len;m++){
							var k = 0,kid = 0,n=0;
							for(var j=0;j<newlen;j++){
								var rowspan = rowspans[m];
								if( j % rowspan==0){
									h[m][j]={ k:specs[m].items[kid].k,title: specs[m].items[kid].title, html: "<td rowspan='" +rowspan + "'>"+ specs[m].items[kid].title+"</td>\r\n",id: specs[m].items[kid].id};
								}else{
									h[m][j]={ k:specs[m].items[kid].k,title:specs[m].items[kid].title, html: "",id: specs[m].items[kid].id};
								}
								n++;
								if(n==rowspan){
									kid++; if(kid>specs[m].items.length-1) { kid=0; }
									n=0;
								}
							}
						}

						var hh = "";
						for(var i=0;i<newlen;i++){

							hh+="<tr>";
							var ks = [];
							var titles = [];
							for(var j=0;j<len;j++){
								hh+=h[j][i].html;
								ks.push( h[j][i].k);
								titles.push( h[j][i].title);
							}
							ks2 =ks.join('_');
							ks =ks.join(',');
							titles =titles.join(',');
							ksarr.push(ks)
							if(typeof(oldgglist[ks])!='undefined'){
								var val = oldgglist[ks];
							}else{
								if(Object.values(oldgglist).length == 0){
									oldgglist ={}
								}
								var val = { procode:'',market_price:'',cost_price:'',sell_price:'',weight:'100',stock:'1000',givescore:'0',givetongzheng:'0',pic:'',lvprice_data:null};
								oldgglist[ks] = val;
							}
							//hh += '<td>';
							//hh += '	<input name="option['+ks+'][procode]" class="layui-input" type="text" style="width:100px" value="'+(val.procode==null?'':val.procode)+'"/>';
							//if(i==0){
							//	hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'procode\')"></i>';
							//}
							// hh += '</td>';
							hh += '<td>';
							hh += '	<input name="option['+ks+'][barcode]" class="layui-input" id="'+ks+'" oninput="barcodeChange(this)" type="text" style="width:100px;" value="'+(val.barcode==null?'':val.barcode)+'"/>';
							if(i==0){
								hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'barcode\')"></i>';
							}
							hh += '</td>';
							hh += '<td>';
							hh += '	<input name="option['+ks+'][name]" type="hidden" value="'+titles+'" class="layui-input"/><input name="option['+ks+'][market_price]" type="text" class="layui-input" id="'+ks+'" oninput="marketPriceChange(this)" style="width:70px" value="'+(val.market_price==null?'':val.market_price)+'"/>';
							if(i==0){
								hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'market_price\')"></i>';
							}
							hh += '</td>';
							hh += '<td>';
							hh += '	<input name="option['+ks+'][cost_price]" id="'+ks+'" oninput="costPriceChange(this)" type="text" class="layui-input" style="width:70px;" value="'+(val.cost_price==null?'':val.cost_price)+'"/>';
							if(i==0){
								hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'cost_price\')"></i>';
							}
							hh += '</td>';
							if(lvprice==1){
								{foreach $levellist as $lk=>$level}
								hh += '<td>';
								if(fillstate){
									 {if $level.price_rate}
									 hh += '<input name="option['+ks+'][sell_price_{$level.id}]" type="text" style="width:70px;" value="'+(val.sell_price==null?'':val.sell_price*{$level.price_rate}).toFixed(2)+'" class="layui-input" id="levelprice_'+i+'_{$lk}"/>';
									 {else}
									 hh += '<input name="option['+ks+'][sell_price_{$level.id}]" type="text" style="width:70px;" value="'+(val.sell_price==null?'':val.sell_price)+'" class="layui-input" id="levelprice_'+i+'_{$lk}"/>';
									 {/if}
								}else{
									hh += '	<input name="option['+ks+'][sell_price_{$level.id}]" type="text" style="width:70px" value="'+(val.lvprice_data==null || val.lvprice_data[{$level.id}]==null?'':val.lvprice_data[{$level.id}])+'" class="layui-input" id="levelprice_'+i+'_{$lk}"/>';
								}
								if(i==0){
									{if $lk==0}
									hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'sell_price_{$level.id}\')"></i>';
									{else}
									hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plsetlevelprice(\''+i+'\',\'{$lk}\')"></i>';
									{/if}
									}
									hh += '</td>';
									{/foreach}
									}else{
										hh += '<td>';
										hh += '	<input name="option['+ks+'][sell_price]" id="'+ks+'" oninput="getusd(this,'+i+')"  type="text" style="width:70px;" value="'+(val.sell_price==null?'':val.sell_price)+'" class="layui-input"/>';
										if(i==0){
											hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'sell_price\')"></i>';
										}
										hh += '</td>';
									}
									{if getcustom('price_dollar') && usdrate>0}
									hh += '<td>';
									hh += '	<input  type="text" id="usdprice'+i+'" class="layui-input" style="width:70px" value="'+(val.usdprice?val.usdprice:'')+'"/>';
									if(i==0){
										hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'cost_price\')"></i>';
									}
									hh += '</td>';
									{/if}

										hh += '<td>';
										hh += ' <input name="option['+ks+'][weight]" type="text" style="width:60px" value="'+(val.weight==null?'':val.weight)+'" class="layui-input"/>';
										if(i==0){
											hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'weight\')"></i>';
										}
										hh += '</td>';
										hh += '<td>';
										hh += ' <input name="option['+ks+'][stock]" type="text" style="width:60px" value="'+(val.stock==null?'':val.stock)+'" class="layui-input"/>';
										{if getcustom('product_stock_warning')}
											if(val.stock<val.stock_warning){
												hh += '<a style="color:red"> 库存不足</a>';
											}
										{/if}
										if(i==0){
											hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'stock\')"></i>';
										}
									
										hh += '</td>';
										{if $bid==0 || $business_selfscore==1}
										hh += '<td>';
										hh += ' <input name="option['+ks+'][givescore]" type="text" style="width:60px" value="'+(val.givescore==null?'':val.givescore)+'" class="layui-input"/>';
										if(i==0){
											hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'givescore\')"></i>';
										}
										hh += '</td>';
										{/if}
											{if getcustom('product_givetongzheng')}
											hh += '<td>';
											hh += ' <input name="option['+ks+'][givetongzheng]" type="text" style="width:60px" value="'+(val.givetongzheng==null?'':val.givetongzheng)+'" class="layui-input"/>';
											if(i==0){
												hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'givetongzheng\')"></i>';
											}
											hh += '</td>';
											{/if}

										{if getcustom('product_handwork')}
											if(product_type == 3){
												hh += '<td class="handfee">';
											}else{
												hh += '<td class="handfee" style="display:none">';
											}
											hh += ' <input name="option['+ks+'][hand_fee]" type="number" min="0" style="width:60px" value="'+(val.hand_fee<=0?'0':val.hand_fee)+'" class="layui-input"/>';
											if(i==0){
												hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'hand_fee\')"></i>';
											}
											hh += '</td>';
										{/if}

											{if getcustom('guige_limit_start')}
											hh += '<td>';
											hh += ' <input name="option['+ks+'][limit_start]" type="number" min="0" style="width:60px" value="'+(val.limit_start<=0?'0':val.limit_start)+'" class="layui-input"/>';
											if(i==0){
												hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'limit_start\')"></i>';
											}
											hh += '</td>';
											{/if}

											{if getcustom('product_stock_warning')}
											hh += '<td>';
											hh += ' <input name="option['+ks+'][stock_warning]" type="number" min="0" style="width:60px" value="'+(val.stock_warning<=0?'0':val.stock_warning)+'" class="layui-input"/>';
											if(i==0){
												hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'limit_start\')"></i>';
											}
											hh += '</td>';
											{/if}
												if(product_type == 4){
													hh += '<td class="showguigeimg" id="ggpic'+ks2+'" style="display:none">';
												}else{
													hh += '<td class="showguigeimg" id="ggpic'+ks2+'">';
												}
												hh += '<input type="hidden" name="option['+ks+'][pic]" id="ggpicval'+ks2+'" value="'+(val.pic==null?'':val.pic)+'"/><div class="guigeimg"><img class="thumb_img" src="'+(val.pic?val.pic:'')+'" style="max-width:50px;"/><a class="layui-imgbox-close guigeimg_close" style="'+(val.pic=='' ||val.pic==null?'display:none':'display:block')+'"    href="javascript:void(0)" onclick="$(this).prev(\'.thumb_img\').attr(\'src\',\'\');$(this).parent().prev(\'input\').val(\'\');$(this).hide();" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a></div> <button class="layui-btn layui-btn-sm layui-btn-primary" onclick="uploader(this)" upload-input="ggpicval'+ks2+'" upload-preview="ggpic'+ks2+'" type="button">上传</button></td>';
												hh += "</tr>";
											}
											let copyarr = {}
											ksarr.forEach(item => {
												Object.keys(oldgglist).forEach(items => {
													if(item == items){
														copyarr[items] =oldgglist[items]
													}
												})
											})
											oldgglist = copyarr;
											html+=hh;
											$("#ggvaldiv").html(html);
											
										}
										function marketPriceChange(obj){
											oldgglist[obj.id].market_price = obj.value;
										}
										function barcodeChange(obj){
											oldgglist[obj.id].barcode = obj.value;
										}
									function costPriceChange(obj){
										oldgglist[obj.id].cost_price = obj.value;
									}
										function getusd(obj,ks){
											oldgglist[obj.id].sell_price = obj.value;
											var price = obj.value;
											var usdrate = '{$usdrate}';
											var usdprice = (price/usdrate).toFixed(2);
											console.log(usdprice);
											$("#usdprice"+ks).val(usdprice);
										}
										function plset(name){
											if(name =='procode'){
												var procode = $("input[name$='["+name+"]']").eq(0).val();
												if(procode == '') procode = randomString(6);
												$("input[name$='["+name+"]']").each(function(i,v){
													if(i>0) $(this).val(procode+ '-'+i);
												})
											}else{
												if(name =='barcode' || name == 'market_price' || name == "cost_price" || name == 'sell_price'){
													Object.values(oldgglist).forEach(item => {
														if(name == 'barcode') return item.barcode = $("input[name$='["+name+"]']").eq(0).val()
														if(name == 'market_price') return item.market_price = $("input[name$='["+name+"]']").eq(0).val()
														if(name == 'cost_price') return item.cost_price = $("input[name$='["+name+"]']").eq(0).val()
														if(name == 'sell_price') return item.sell_price = $("input[name$='["+name+"]']").eq(0).val()
													})
												}
												$("input[name$='["+name+"]']").val($("input[name$='["+name+"]']").eq(0).val());
											}
										}
										function plsetlevelprice(i,k){
											var thisprice = $('#levelprice_'+i+'_'+k).val();
											console.log(thisprice)
											var level0price = $('#levelprice_0_0').val();
											console.log(level0price)
											var pricepercent = thisprice / level0price;
											console.log(pricepercent)
											$("input[name$='][market_price]']").each(function(i2,v2){
												var this_price = ($('#levelprice_'+i2+'_0').val() * pricepercent).toFixed(2);
												console.log(this_price)
												this_price = parseInt(this_price*100)/100;
												$('#levelprice_'+i2+'_'+k).val(this_price);
											})
										}
										function randomString(len) {
											len = len || 32;
											var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
											var maxPos = $chars.length;
											var pwd = '';
											for (i = 0; i < len; i++) {
												pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
											}
											return pwd;
										}

										layui.form.on('checkbox(gettjset)', function(data){
											console.log(data)
											if(data.elem.checked){
												$('#gettjset').hide();
											}else{
												$('#gettjset').show();
											}
										});
										var chooseUrlField = '';
										function chooseUrl2(field){
											chooseUrlField = field;
											layer.open({type:2,shadeClose:true,area:['1100px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}&callback=chooseLink2"})
										}
										function chooseLink2(urlname,url){
											$("#"+chooseUrlField).val(url);
										}

										function showChooseCategory(){
											layer.open({type:2,title:'选择类目',content:"{:url('Wxvideo/allcategory')}&ischoose=1",area:['900px','600px'],shadeClose:true});
										}
										function chooseCategory(data){
											console.log(data)
											$("input[name='info[wxvideo_third_cat_id]']").val(data.third_cat_id);
										}

										/**
										 * 1.监听select的选中与取消
										 *
										 * formSelects.on(ID, Function);
										 *
										 * @param ID        xm-select的值
										 * @param Function  自定义处理方法
										 * @param isEnd     是否获取实时数据, true/false
										 */
										var formSelects = layui.formSelects;
										var paramdata='{$info[\'paramdata\']}';
									    if(paramdata !='' && paramdata != null){
											paramdata = JSON.parse(paramdata);
									    }
										formSelects.on('selectCid', function(id, vals, val, isAdd, isDisabled){
											//console.log($("input[name='info[cid]']").val())
											var cid = $("input[name='info[cid]']").val();
											$.post("{:url('getParam')}",{cid:cid},function(data){
												if(data.status == 1){
													var paramlist = data.paramlist;
													var html = '';
													for(var i=0;i<paramlist.length;i++){
														html += '<div class="layui-form-item">';
														html += '	<label class="layui-form-label">';
														if(paramlist[i]['is_required']==1) html += '<span class="redstar">*</span>';
														html += paramlist[i]['name'];html += '：</label>';
														if(paramlist[i]['type']=='0'){
															html += '<div class="layui-input-inline" style="width:240px">';
															html += '<input type="text" class="layui-input" name="paramdata['+paramlist[i]['name']+']" ';
															if(typeof (paramdata[paramlist[i]['name']]) != 'undefined')
																html +=' value="'+ paramdata[paramlist[i]['name']]+'"';
															if(paramlist[i]['is_required']==1) html += ' lay-verify="required" lay-verType="tips"';
															html += ' placeholder="'+paramlist[i]['tips']+'"/>';
															html += '</div>';
														}else if(paramlist[i]['type']=='1'){
															html += '<div class="layui-input-inline" style="width:240px">';
															html += '	<select name="paramdata['+paramlist[i]['name']+']"';
															if(paramlist[i]['is_required']==1) html += ' lay-verify="required" lay-verType="tips"';
															html += '	>';
															html += '<option value="">'+paramlist[i]['tips']+'</option>';
															//console.log(paramlist[i]['params'])
															var parsms = JSON.parse(paramlist[i]['params']);
															for(var j=0;j<parsms.length;j++){
																if (paramdata[paramlist[i]['name']] == parsms[j]){
																	html += '<option selected>'+parsms[j]+'</option>';
																}else{
																	html += '<option>'+parsms[j]+'</option>';
																}
															}
															html += '</select></div>';
														}else if(paramlist[i]['type']=='2'){
															html += '<div class="layui-input-inline" style="width:240px">';
															var parsms = JSON.parse(paramlist[i]['params']);
															for(var j=0;j<parsms.length;j++){
																html += '<input type="checkbox" name="paramdata['+paramlist[i]['name']+'][]" value="'+parsms[j]+'" title="'+parsms[j]+'" lay-skin="primary" ';
																if(Array.isArray(paramdata[paramlist[i]['name']]) && paramdata[paramlist[i]['name']].indexOf(parsms[j]) != -1) html += ' checked';
																html += ' />';
															}
															html += '</div>';
															html += '<div class="layui-form-mid layui-word-aux" style="clear:left;margin-left:130px">{$param.tips}</div>';
														}

														html += '</div>';

													}
													if(paramlist.length == 0){
														html = '<div class="layui-form-item"><label class="layui-form-label"></label><div class="layui-form-mid">暂未添加商品参数或当前商品分类下无参数，<a href="javascript:void(0)" onclick="openmax(\'{:url(\'ShopParam/index\')}&isopen=1\')">去添加</a></div></div>';
													}
// console.log(html);
													$(".paramTab").html(html);

													layui.form.render();
												}
											})
											//id:           点击select的id
											//vals:         当前select已选中的值
											//val:          当前select点击的值
											//isAdd:        当前操作选中or取消
											//isDisabled:   当前选项是否是disabled

											//如果return false, 那么将取消本次操作
											// return false;
										},true);
</script>
<script type="text/javascript">
	function chooseUrlWindow(){
		layer.open({type:2,shadeClose: true,area: ['1100px', '650px'],'title': '选择链接',content: "{:url('DesignerPage/chooseurl')}&callback=chooseLinkWindow"})
	}
	function chooseLinkWindow(link_name,link_url,arg=''){
		if (link_url){
			$('#buybtn_link_url').val(link_url);
			$('#buybtn_link_name').val(link_name);
			$('.buybtn_link_name').html(link_name);
			layer.closeAll();
		}
	}
	function chooseUrlWindow2(){
		layer.open({type:2,shadeClose: true,area: ['1100px', '650px'],'title': '选择链接',content: "{:url('DesignerPage/chooseurl')}&callback=chooseLinkWindow2"})
	}
	function chooseLinkWindow2(link_name,link_url,arg=''){
		if (link_url){
			$('#addcart_link_url').val(link_url);
			$('#addcart_link_name').val(link_name);
			$('.addcart_link_name').html(link_name);
			layer.closeAll();
		}
	}
</script>
<script>
	layui.form.on('radio(show_recommend)',function(data){
		if(data.value == 2){
			$('.show_recommend2').show();
		}else{
			$('.show_recommend2').hide();
		}
	})
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		field.specs = JSON.stringify(specs)
		//field['info[detail]'] = ueditor.getContent();
		field['info[detail]'] = geteditordata();
		//console.log(field);return;
		if(field['info[freighttype]'] == 0 && field['info[freightdata]'] == ''){
			dialog('请选择运费模板');
			return;
		}
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){

			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})
	layui.form.on('radio(price_type)',function(data){
		if(data.value==1){
			$('#xunjia_item').show();
		}else{
			$('#xunjia_item').hide();
		}
	})
	layui.form.on('radio(show_xunjia_btn)',function(data){
		if(data.value==1){
			$('#xunjia_btn_txt').show();
		}else{
			$('#xunjia_btn_txt').hide();
		}
	})
	{if getcustom('product_xunjia_btn')}
	var chooseUrlFieldCt = '';
	function showChooseContactLink(field){
		chooseUrlFieldCt = field;
		layer.open({type:2,shadeClose:true,area:['1100px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}&callback=chooseLinkContact"})
	}
	function chooseLinkContact(urlname,url){
		$("#"+chooseUrlFieldCt).val(url);
	}
	{/if}
	
	layui.form.on('radio(productType)',function(data){
		{if getcustom('product_handwork')}
			$(".product_type").val(data.value);
			if(data.value!=3){
				$('.handfee').hide();
			}else if(data.value==3){
				$('.handfee').show();
			}
		{/if}
		{if getcustom('product_wholesale')}
			$(".product_type").val(data.value);
			if(data.value!=4){
				$('.jieti_discount').hide();
				$('.showguigeimg').show();

			}else if(data.value==4){
				$('.jieti_discount').show();
				$('.showguigeimg').hide();
			}
		{/if}
	})
		{if getcustom('commission_parent_pj_stop_product')}
		layui.form.on('radio(commissionpj)', function(data){
			if(data.value == '1'){
				$('.commissionpj').show();
			}else{
				$('.commissionpj').hide();
			}
		})
		{/if}

</script>
{include file="public/copyright"/}
</body>
</html>